Smoothing rounded window corners

Hi

I created a window with rounded edges using the CreateRoundRgn and SetWindowRgn APIs, but the rounded corners are not as smooth as the rounded rectangle drawn with GDI + says. Is there any way to smooth the corners of a window?

procedure TPBSDashboardPanel.DefineWindowRegion;
var
  WindowRegion: HRGN;
begin
  if Assigned(Parent) then
  begin
    WindowRegion := CreateRoundRectRgn(0, 0, Width, Height, 20, 20);

    SetWindowRgn(Handle, WindowRegion, True);
  end;
end;
+2
source share
3 answers

Perhaps use a bitmap with alpha transparency to simulate anti-aliasing in addition to a slightly larger rounded region, allowing Windows to do impact tests.

, Win32 GDI , , , , , , .

PS: AFAIK , , , Win32 . WDM Windows 7 , , , , .

+3

, . () , ( ) , . Google.

+5

I am not an expert on this, but I know that GDI + supports anti-aliasing, while GDI does not. Without smoothing, rounded corners will not look smooth.

0
source

All Articles