Rounded and titled “TPanel” in Delphi 7

后端 未结 2 1168
有刺的猬
有刺的猬 2021-02-02 02:31

I would have a TPanel in my application but with another look.
For it I want a colored title bar and the up corner rounded just like in some user interfaces like it Do you k

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-02 02:58

    If you wanna round the corner of anything you want, try this:

    procedure RoundCornerOf(Control: TWinControl) ;
    var
       R: TRect;
       Rgn: HRGN;
    begin
       with Control do
       begin
         R := ClientRect;
         rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 20, 20) ;
         Perform(EM_GETRECT, 0, lParam(@r)) ;
         InflateRect(r, - 4, - 4) ;
         Perform(EM_SETRECTNP, 0, lParam(@r)) ;
         SetWindowRgn(Handle, rgn, True) ;
         Invalidate;
       end;
    end;
    

提交回复
热议问题