C# Form Design - Form design bottom edge not coming properly in Laptop resolution

  • Thread starter Thread starter Gani tpt
  • Start date Start date
G

Gani tpt

Guest
I am facing one more issue. bottom curve edge not coming properly in my laptop resolution.

the same alignment will be working in desktop properly. but, when i am checking the form at my laptop then the bottom edge is not coming properly.

when i am using the form at my laptop, the alignment not showing proper in bottom. But, the same will be working and perfect @ my desktop.

where i want to change the resolution and it should be the perfect for both laptop and desktop.

below is the screenshot.

1624671.png


below is the source code.

protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
using (System.Drawing.Drawing2D.GraphicsPath gp = CreatePath(new System.Drawing.Rectangle(System.Drawing.Point.Empty, base.Size), 45, true))
{
Pen redPen = new Pen(Color.FromArgb(233, 131, 0), 5);
e.Graphics.DrawPath(redPen, gp);
}
base.OnPaint(e);
}

//draw rectangle corner in the form
public static System.Drawing.Drawing2D.GraphicsPath CreatePath(System.Drawing.Rectangle rect, int nRadius, bool bOutline)
{
int nShift = bOutline ? 1 : 0;
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddArc(rect.X + nShift, rect.Y, nRadius, nRadius, 180f, 90f);
path.AddArc((rect.Right - nRadius) - nShift, rect.Y, nRadius, nRadius, 270f, 90f);
path.AddArc((rect.Right - nRadius) - nShift, (rect.Bottom - nRadius) - nShift, nRadius, nRadius, 0f, 90f);
path.AddArc(rect.X + nShift, (rect.Bottom - nRadius) - nShift, nRadius, nRadius, 90f, 90f);
path.CloseFigure();
return path;
}


protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCHITTEST)
{
m.Result = new IntPtr(HTCAPTION);
return;
}
if (m.Msg == WM_NCRBUTTONDOWN)
{
m.Result = (IntPtr)0;
System.Threading.Thread.Sleep(200);
this.Close();
return;
}
else
base.WndProc(ref m);
}


the same alignment will be working in desktop properly. but, when i am checking the form at my laptop then the bottom edge is not coming properly.

Continue reading...
 
Back
Top