Home > System > How to Create Elliptic Forms

How to Create Elliptic Forms

December 15th, 1999 m3Rlin Leave a comment Go to comments

Ever wanted to create forms that had a cool shape? How about an elliptic form? This would make a nice splash screen, wouldn’t it? Sure. But how can I create one of these? Hmmmm… Well, Windows 32 bit has all we need. CreateEllipticRgn() allows you to create an elliptic region. After we do so all we have to do is assign the region to our form. This can be done using the SetWindowRgn() function determines the area of a window that can be drawn on. The area not included in this region will not be displayed. You can use the first function a couple of times to create “weird” shapes :-) Then assign the created region using the second routine.

Add this code to your form’s OnCreate event:

var
  rgnNew: Hrgn; // The region variable
  ...
begin
  ...
  rgnNew := CreateEllipticRgn(1, 1, 100, 100); // A small circle
  { Work on the region here if you want to change it a bit more }
  SetWindowRgn(Handle, rgnNew, True);
  ...
end;
  1. No comments yet.