---- Example - Making a form in the shape of a baloon -----{ Put the following code in the event handler of a button in a form. Put the button in the center of the form. When the button is clicked, the form will change shape. See the Win32.Hlp and look into the Region Reference to be able to create any Region for the window } procedure TForm1.Button1Click(Sender: TObject); var Reg1: HRGN; Reg2: HRGN; Reg: HRGN; Apoint: Array[0..2] of TPoint; begin APoint[0] := Point(40,ClientHeight-30); APoint[1] := Point(30,ClientHeight); APoint[2] := Point(20,ClientHeight-20); Reg1 := CreatePolygonRgn(Apoint, 3, WINDING); Reg2 := CreateRoundRectRgn ( Width-ClientWidth, Height-ClientHeight, ClientWidth, ClientHeight - 10, 55, 55); Reg := CreateRectRgn(150,50,200,100); CombineRgn(Reg, Reg1, Reg2, RGN_OR); SetWindowRgn (handle, Reg, true); DeleteObject(Reg1); DeleteObject(Reg2); { Do not delete Reg object cause it is now owned by the OS } end;
in a form. Put the button in the center of the form.
When the button is clicked, the form will change shape.
See the Win32.Hlp and look into the Region Reference
to be able to create any Region for the window }
procedure TForm1.Button1Click(Sender: TObject);
var
Reg1: HRGN;
Reg2: HRGN;
Reg: HRGN;
Apoint: Array[0..2] of TPoint;
begin
APoint[0] := Point(40,ClientHeight-30);
APoint[1] := Point(30,ClientHeight);
APoint[2] := Point(20,ClientHeight-20);
Reg1 := CreatePolygonRgn(Apoint, 3, WINDING);
Reg2 := CreateRoundRectRgn ( Width-ClientWidth,
Height-ClientHeight,
ClientWidth,
ClientHeight - 10, 55, 55);
Reg := CreateRectRgn(150,50,200,100);
CombineRgn(Reg, Reg1, Reg2, RGN_OR);
SetWindowRgn (handle, Reg, true);
DeleteObject(Reg1);
DeleteObject(Reg2);
{ Do not delete Reg object cause it is now owned by the OS }
end;