我有一段delphi代码,请高手能给我详细的解释,谢谢(争取每句后面都有中文注释)
unitUnit1;interfaceusesWindows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dial...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
Button1: TButton;
Button2: TButton;
procedure Timer2Timer(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Timer2Timer(Sender: TObject);
begin
if not (form1.ClientHeight = 50) then
begin
form1.ClientHeight := form1.ClientHeight - 10;
end else timer2.Enabled := false;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if not (form1.ClientHeight = 350) then
begin
form1.ClientHeight := form1.ClientHeight + 10;
end else timer1.Enabled := false;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
form1.ClientWidth := 400;
form1.ClientHeight := 40;
timer1.enabled := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
timer2.enabled := true;
button2.visible := true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
timer1.enabled := true;
end;
end. 展开
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
Button1: TButton;
Button2: TButton;
procedure Timer2Timer(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Timer2Timer(Sender: TObject);
begin
if not (form1.ClientHeight = 50) then
begin
form1.ClientHeight := form1.ClientHeight - 10;
end else timer2.Enabled := false;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if not (form1.ClientHeight = 350) then
begin
form1.ClientHeight := form1.ClientHeight + 10;
end else timer1.Enabled := false;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
form1.ClientWidth := 400;
form1.ClientHeight := 40;
timer1.enabled := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
timer2.enabled := true;
button2.visible := true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
timer1.enabled := true;
end;
end. 展开
2个回答
展开全部
if not (form1.ClientHeight = 50) then //如果窗体的高不等于50那么
begin
form1.ClientHeight := form1.ClientHeight - 10; //窗体的高度等于窗体的高减去10
end else timer2.Enabled := false; //否则将timer2停止.
下边那个思路一样.略.
form1.ClientWidth := 400; //窗体宽为400
form1.ClientHeight := 40; //高为50
timer1.enabled := true; //timer1启动
timer2.enabled := true; //timer2启动
button2.visible := true; //button2设置为可视
begin
form1.ClientHeight := form1.ClientHeight - 10; //窗体的高度等于窗体的高减去10
end else timer2.Enabled := false; //否则将timer2停止.
下边那个思路一样.略.
form1.ClientWidth := 400; //窗体宽为400
form1.ClientHeight := 40; //高为50
timer1.enabled := true; //timer1启动
timer2.enabled := true; //timer2启动
button2.visible := true; //button2设置为可视
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询