📄 setrectemtpyu.pas
字号:
unit SetRectEmtpyU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormActivate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
TheRect: TRect; // holds the rectangle
implementation
{$R *.DFM}
procedure TForm1.FormActivate(Sender: TObject);
begin
{create a new rectangle}
SetRect(TheRect, 8, 40, 169, 160);
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
{display the rectangle}
Form1.Canvas.Brush.Color := clRed;
Form1.Canvas.FillRect(TheRect);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
{empty the rectangle}
SetRectEmpty(TheRect);
{indicate if the rectangle is empty}
if IsRectEmpty(TheRect) then
Button1.Caption := 'Rectangle is empty'
else
Button1.Caption := 'Rectangle is not empty';
{repaint the form to show the changes}
Form1.Repaint;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -