吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2197|回复: 4
收起左侧

[其他转载] 关于Delphi向导界面的制作

[复制链接]
冥界3大法王 发表于 2021-9-29 22:20
上来以为没啥啊,就按网上下载的pdf来做,谁知上机一调试就报错!
于是结合网上说的,自己又琢磨了调试了几次就得到了下面的结论:
image.png
image.png
image.png

image.png

[Delphi] 纯文本查看 复制代码
unit 以向导方式生成按键2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
  Vcl.ComCtrls, sPageControl, Vcl.StdCtrls, sCheckBox, sGroupBox, sRadioButton,
  sButton, sComboBox, sLabel, sMemo;

type
  TForm2 = class(TForm)
    sPageControl1: TsPageControl;
    sTabSheet1: TsTabSheet;
    sTabSheet2: TsTabSheet;
    sTabSheet3: TsTabSheet;
    sGroupBox1: TsGroupBox;
    sCheckBox1: TsCheckBox;
    sCheckBox2: TsCheckBox;
    sCheckBox3: TsCheckBox;
    sGroupBox2: TsGroupBox;
    sRadioButton1: TsRadioButton;
    sRadioButton2: TsRadioButton;
    sButton1: TsButton;
    sGroupBox3: TsGroupBox;
    sRadioButton3: TsRadioButton;
    sRadioButton4: TsRadioButton;
    sGroupBox4: TsGroupBox;
    sRadioButton5: TsRadioButton;
    sRadioButton6: TsRadioButton;
    sButton2: TsButton;
    sComboBox1: TsComboBox;
    sComboBox2: TsComboBox;
    sCheckBox4: TsCheckBox;
    sGroupBox6: TsGroupBox;
    sGroupBox5: TsGroupBox;
    sRadioButton7: TsRadioButton;
    sRadioButton8: TsRadioButton;
    sComboBox3: TsComboBox;
    sComboBox4: TsComboBox;
    sGroupBox28: TsGroupBox;
    sCheckBox5: TsCheckBox;
    sCheckBox6: TsCheckBox;
    sCheckBox7: TsCheckBox;
    sCheckBox8: TsCheckBox;
    sCheckBox9: TsCheckBox;
    sCheckBox10: TsCheckBox;
    sCheckBox11: TsCheckBox;
    sCheckBox12: TsCheckBox;
    sCheckBox13: TsCheckBox;
    sCheckBox14: TsCheckBox;
    sLabel3: TsLabel;
    sGroupBox30: TsGroupBox;
    sMemo27: TsMemo;
    procedure sButton1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure sButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;
  MouseTimes: Integer;    //用于记录【下一步按钮】点击的次数

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
  MouseTimes := 0;
end;

procedure TForm2.sButton1Click(Sender: TObject);      //第1次点击【下一步按钮时】
begin
  sTabSheet1.TabVisible := False;
  sTabSheet2.TabVisible := True;
  sPageControl1.Activepage := Form2.sTabSheet2;
  sButton1.Caption := '完成';
  sButton2.Visible := True;
  MouseTimes := MouseTimes + 1;
//  ShowMessage(IntToStr(MouseTimes));
  if (MouseTimes > 1) and (sButton1.Caption = '完成') then         //if (MouseTimes > 1)显然这么写不对了
  {所以正确的写法是sTabSheet2.TabVisible = True 或 被sTabSheet2被激活时   and (sButton1.Caption = '完成') then
   才去执行生成代码!                                sPageControl1.ActivePage:=sTabSheet2
  }
  begin
//    ShowMessage('按钮被点击!' + #13#10 + '这里写2-1生成的代码');
    if sRadioButton1.Checked = True then
    begin
      ShowMessage('1111');
    end;

    if sRadioButton2.Checked = True then
    begin
//      ShowMessage('sRadioButton2被选中!');
      sTabSheet3.TabVisible := True;
      sTabSheet2.TabVisible := False;
      sTabSheet1.TabVisible := False;
      sButton1.Caption := '完成'
    end;
    //这里再写第一页中4个CheckBox的判断
    //再写第2页中的内容
  end;
//  ShowMessage('over');
end;

procedure TForm2.sButton2Click(Sender: TObject);    //点击【上一步按钮时】
begin
  sTabSheet1.TabVisible := True;
  sTabSheet2.TabVisible := False;
  sTabSheet3.TabVisible := False;
  sButton1.Caption := '下一步';
  sButton2.Visible := False;
end;

end.

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
笙若 + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| 冥界3大法王 发表于 2021-9-29 22:23
其实感觉吧,
MouseTimes: 记录【下一步按钮】点击的次数
也没啥用啊
不如判断TabSheet激活+Button1.caption='完成' 来得更直接
popa 发表于 2021-9-29 23:31
zxxiaopi 发表于 2021-9-30 09:08
头像被屏蔽
yulinsoft 发表于 2021-9-30 21:07
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 11:30

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表