procedure TForm1.Button1Click(Sender: TObject); <br>var <br>r1,r2,r3,r4,r5: hrgn; <br>begin <br> r1 := createellipticrgn(0,0,round(clientwidth / 2),clientheight); <br> r2 := createellipticrgn(round(clientwidth / 2),0,clientwidth,clientheight); <br> r3 := createellipticrgn(round(clientwidth / 4 ),round(clientheight / 4 *3),round(clientwidth / 4 *3),clientheight); <br> r4 := createrectrgn(0,0,0,0); <br> r5 := createrectrgn(0,0,0,0); <br> combinergn(r4,r2,r1,rgn_or); <br> combinergn(r5,r4,r3,rgn_or); <br><br> setwindowrgn(handle,r5,true); <br> deleteobject(r1); <br> deleteobject(r2); <br> deleteobject(r3); <br> deleteobject(r4); <br> deleteobject(r5); <br>end; <br><br>你照着我的一个例子来试试,窗体宽260,高270.实现类似于橢圓的窗口,还有边线. <br>procedure TFrmAbout.FormCreate(Sender: TObject); <br>var hr:THandle; <br>begin <br> hr:=CreateRoundRectRgn(0,21,Width,Height,80,80); //定義橢圓窗口 <br> SetWindowRgn(handle,hr,true); <br>end; <br><br>procedure TFrmAbout.DrawFormLine; <br>var <br> dc : hDc; <br> Pen : hPen; <br> OldPen : hPen; <br> OldBrush : hBrush; <br>begin <br> dc := GetWindowDC(Handle); <br> Pen := CreatePen(PS_SOLID, 8, RGB(0, 0, 255)); <br> OldPen := SelectObject(dc, Pen); <br> OldBrush := SelectObject(dc, GetStockObject(NULL_BRUSH)); <br> Self.Refresh; <br> RoundRect(dc,0,21,Width,Height,80,80); //©w¸q¾ò¶êµ¡¤f <br> SelectObject(dc, OldBrush); <br> SelectObject(dc, OldPen); <br> DeleteObject(Pen); <br> ReleaseDC(Handle, Canvas.Handle); <br>end; <br><br>procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPAINT; <br>procedure TFrmAbout.WMNCPaint(var Msg: TWMNCPaint); <br>begin <br> DrawFormLine; <br>end;