1 unit Unit1; 2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, ExtCtrls, StdCtrls; 8 9 type10 TForm1 = class(TForm)11 Panel1: TPanel;12 Edit1: TEdit;13 procedure FormShow(Sender: TObject);14 private15 { Private declarations }16 public17 { Public declarations }18 end;19 20 var21 Form1: TForm1;22 23 implementation24 25 {$R *.dfm}26 27 procedure TForm1.FormShow(Sender: TObject);28 var29 Rgn: HRGN;30 begin31 //参数:Handle的左上角left top 右下角right bottom 弧度0-->25532 Rgn := CreateRoundRectRgn(0,0, width,height,50,50);33 SetWindowRgn(handle, Rgn, True);34 35 //若是Panel1设置弧度:BorderStyle 最好设成 bsNone36 //若是Panel1设置弧度:BevelInner和BevelOuter 最好设成 bvNone37 end;38 39 end.