Delphi example demonstrates the difference between rect and bounds generation Trect _delphi

Source: Internet
Author: User

This article demonstrates the difference between rect and bounds generation Trect with an example code as follows:

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); {Parameter 3, 4 is a point}
2:button1.boundsrect: = Bounds (50,50,100,80); {Parameters 3, 4 are width and height}
End;
End;

End.

The final implementation of the effect diagram is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.