RAD Studio for Microsoft .NET
ContentsIndex
PreviousUpNext
Drawing a Rounded Rectangle in a VCL Forms Application

These procedures draw a rounded rectangle in a VCL form.

  1. Create a VCL form.
  2. Code the form's OnPaint event handler to draw a polygon.
  3. Build and run the application.

To create a VCL form

  1. Choose FileNewOtherDelphi for .NET ProjectsVCL Forms Application.
  2. In the Designer, click the form, if necessary, to display Form1 properties in the Object Inspector.

To write the OnPaint event handler

  1. In the Object Inspector, click the Events tab.
  2. Double-click the OnPaint event handler in the Visual category. The Code Editor displays with the cursor in the TForm1.FormPaint event handler block.
  3. Enter the following event handling code:

Canvas.RoundRect(0, 0, ClientWidth div 2,
  ClientHeight div 2, 10, 10);
To run the program

  1. Save all files in your project.
  2. Select RunRun.
  3. The application executes, displaying a rounded rectangle in the upper left quadrant of the form.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!