⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 DELPHI经典程序
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    Button1: TButton;
    GroupBox2: TGroupBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    Button2: TButton;
    CheckBox6: TCheckBox;
    Button3: TButton;
    procedure CheckBox5MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
    CheckBox4.AllowGrayed := False;
    CheckBox5.AllowGrayed := True;
end;

procedure TForm1.Button1Click(Sender: TObject);
  var
    foodStr : String;
begin
    foodStr := '';
    if CheckBox1.Checked then
       foodStr := foodStr + ' 猴脑';
    if CheckBox2.Checked then
       foodStr := foodStr + ' 牛肉叉烧包';
    if CheckBox3.Checked then
       foodStr := foodStr + ' 蜜汁熊掌';
    ShowMessage('你选的菜单是' + foodStr);
end;

procedure TForm1.CheckBox5MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
    Form2.ShowModal;
end;

procedure TForm1.Button2Click(Sender: TObject);
   var
      seleITEM : String;
begin
   seleITEM := '';
   if CheckBox4.Checked then
     seleITEM := ' 魔法';

   if not (CheckBox5.State = cbUnchecked) then
     seleITEM := seleITEM + ' 道具';

   ShowMessage('你选了' + seleITEM);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
    case CheckBox6.Alignment of
       taLeftJustify:
         begin
           CheckBox6.Alignment := taRightJustify;
           Button3.Caption := 'Alignment ' + 'Right';
         end;
       taRightJustify:
         begin
           CheckBox6.Alignment := taLeftJustify;
           Button3.Caption := 'Alignment ' + 'Left';
         end;
    end;
end;





end.

⌨️ 快捷键说明

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