111,120
社区成员
发帖
与我相关
我的任务
分享
g.DrawLine(new Pen(Brushes.Blue, 2), new PointF(this.Width - this.Height, 0), new PointF(this.Width - this.Height, this.Height));
[System.Runtime.InteropServices.DllImport("user32.dll ")]
static extern IntPtr GetWindowDC(IntPtr hWnd);
[System.Runtime.InteropServices.DllImport("user32.dll ")]
static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == 0xf || m.Msg == 0x133)
{
IntPtr hDC = GetWindowDC(m.HWnd);
if (hDC.ToInt32() == 0)
{ return; }
Graphics g = Graphics.FromHdc(hDC);
//画边框
Rectangle rect = new Rectangle(0, 0, Width, Height);
//画坚经
Rectangle rect1 = new Rectangle(Width - Height, 0, Height, Height);
ControlPaint.DrawBorder(g, rect, Color.Red, ButtonBorderStyle.Solid);
ControlPaint.DrawBorder(g, rect1, Color.Red, ButtonBorderStyle.Solid);
ReleaseDC(m.HWnd, hDC);
}
}