unit2.pas.~5~

来自「Delphi 2005程序设计教程_实例源文件和教学课件」· ~5~ 代码 · 共 49 行

~5~
49
字号
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Borland.Vcl.StdCtrls, System.ComponentModel;

type
  TForm2 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    Button1: TButton;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form2:TForm2;
implementation

{$R *.nfm}

procedure TForm2.Button1Click(Sender: TObject);
var
  attr:word;
begin
  attr:=  FileGetAttr(Label2.Caption);
  if CheckBox1.Checked then
    attr:=attr or faReadOnly;
  if CheckBox2.Checked then
    attr:=attr or faHidden;
  FileSetAttr(Label2.Caption,attr);
  Self.close;
end;


end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?