jeudi 7 mars 2019

Can't maximize The Form When I Used The Rounded Borders in Windows Form C#

I have a form with rounded borders by codes below:

[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, 30, 30));
    }

But the problem is:When I Maximize the form, It doesn't maximize correctly. It Maximizes like this:Image Please Help Me...

Aucun commentaire:

Enregistrer un commentaire