Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a round form?

Status
Not open for further replies.

MirceaVleju

Programmer
Oct 10, 2003
32
0
0
RO
If you have winamp 2.x and a lot of skins with it then you can see that some skins have the winamp window a circle or an ellipse not a rectangle. I have trie to do this with the BitBlt function but with no secces. Do You have any ideea?
 
Use windows API call CreatePolygonRgn to create non-rectangular forms.

There may be a similar function that actually handles round, otherwise you will have to have enough points in RgnPts to make it look round.

I have this as a form viable, not local var. I suspect that is necessary.

RgnPts:array[0..13] of TPoint;

The following going in FormCreate

var
Region: hRgn;
begin
{initialise RgnPts here to give desired shape of the form}

Region := CreatePolygonRgn(RgnPts[0], Length(RgnPts), ALTERNATE);
{ Assign the region to the window }
SetWindowRgn(Handle, Region, True);

Have fun, you can do amazing things with this.
Simon
 
procedure TForm1.FormCreate(Sender: TObject);
var
CLFRgn: HRgn;
const
Size = 300;
begin
Self.Width := Size;
Self.Height := Size;
CLFRgn := CreateEllipticRgn(0,0,Self.Width,Self.Height);
SetWindowRgn(Self.Handle,CLFRgn,True);
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top