Delphi实例演示Rect、Bounds生成TRect的区别 Delphi实例演示Rect、Bounds生成TRect的区别
人气:0想了解Delphi实例演示Rect、Bounds生成TRect的区别的相关内容吗,在本文为您仔细讲解Delphi实例演示Rect、Bounds生成TRect的区别的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Delphi,Rect,Bounds,TRect,区别,下面大家一起来学习吧。
本文以实例演示Rect、Bounds生成TRect的区别,实例代码如下:
unitUnit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; RadioGroup1: TRadioGroup; procedure RadioGroup1Click(Sender: TObject); procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} var R: TRect; procedure TForm1.FormCreate(Sender: TObject); begin RadioGroup1.Items.CommaText := 'Undo,Rect,Bounds'; R := Button1.BoundsRect; end; procedure TForm1.RadioGroup1Click(Sender: TObject); begin case RadioGroup1.ItemIndex of 0: Button1.BoundsRect := R; 1: Button1.BoundsRect := Rect(50,50,100,80); {参数3、4 是一个点} 2: Button1.BoundsRect := Bounds(50,50,100,80);{参数3、4 分别是宽度与高度} end; end; end.
最终实现效果图如下:
加载全部内容