procedure TForm1.FormCreate(Sender: TObject);<br>var<br> mFullRgn, mClientRgn, mButtonRgn, mButtonCoverRgn: THandle;<br> mLeftMargin,mTopMargin:Integer;<br> mMargin, mX, mY: Integer;<br> mInt:integer;<br>begin<br> mMargin := (Width - ClientWidth) div 2;<br> mFullRgn := CreateRectRgn(0, 0, Width, Height);<br> mLeftMargin := mMargin;<br> mTopMargin := Height - ClientHeight - mMargin;<br> mClientRgn := CreateRectRgn(mLeftMargin, mTopMargin, mLeftMargin + ClientWidth, mTopMargin + ClientHeight);<br> CombineRgn(mFullRgn, mFullRgn, mClientRgn, RGN_DIFF); <br><br> for mInt:= 0 to ComponentCount-1 do<br> begin<br> if not (Components[mInt] is TWinControl) then continue;<br> if (Components[mInt] as TWinControl).Parent<>self then continue;<br> mX := mLeftMargin + (Components[mInt] as TWinControl).Left ;<br> mY := mTopMargin + (Components[mInt] as TWinControl).Top ;<br> mButtonRgn := CreateRectRgn(mX, mY, mX + (Components[mInt] as TWinControl).Width , mY + (Components[mInt] as TWinControl).Height);<br> CombineRgn(mFullRgn, mFullRgn, mButtonRgn, RGN_OR); <br> mButtonCoverRgn := CreateRectRgn(mX+2, mY+2, mX + (Components[mInt] as TWinControl).Width-4 , mY + (Components[mInt] as TWinControl).Height-4); <br> CombineRgn(mFullRgn, mFullRgn, mButtonCoverRgn, RGN_DIFF);<br> end;<br><br> SetWindowRgn(Handle, mFullRgn, True);<br>end;