winforms - C# Form with custom border and rounded edges -


i using code make form (formborderstyle=none) rounded edges:

[dllimport("gdi32.dll", entrypoint = "createroundrectrgn")] private static extern intptr createroundrectrgn (     int nleftrect, // x-coordinate of upper-left corner     int ntoprect, // y-coordinate of upper-left corner     int nrightrect, // x-coordinate of lower-right corner     int nbottomrect, // y-coordinate of lower-right corner     int nwidthellipse, // height of ellipse     int nheightellipse // width of ellipse  );  public form1() {     initializecomponent();     region = system.drawing.region.fromhrgn(createroundrectrgn(0, 0, width, height, 20, 20)); } 

and set custom border on paint event:

    controlpaint.drawborder(e.graphics, this.clientrectangle, color.black, 5, buttonborderstyle.solid, color.black, 5, buttonborderstyle.solid, color.black, 5, buttonborderstyle.solid, color.black, 5, buttonborderstyle.solid); 

but see screenshot.

the inside form rectangle doesn't have rounded edges.

how can make blue inside form rectangle have rounded edge wont screenshot?

the region propery cuts off corners. have true rounded corner have draw rounded rectangles.

drawing rounded rectangles

it might easier draw image of shape want , put on transparent form. easier draw cannot resized.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -