admin 管理员组文章数量: 887021
2023年12月22日发(作者:springboot代码结构)
c(ref m); } private void OnWmNcPaint(ref Message m) { rcWnd = new (); dowRect(, ref rcWnd); int intWidth = ; int intHeight = ; int width = ; int height = ; IntPtr hRgn = RectRgn(0, 0, width, height); if (hRgn != ) { IntPtr hDc = dowDC(); if (hDc != ) { IntPtr memDc = CompatibleDC(hDc); if (memDc != ) { IntPtr hBmp = CompatibleBitmap(hDc, width, height); if (hBmp != ) { IntPtr hObj = Object(memDc, hBmp); if (32() != 1) { IntPtr tmpRgn = RectRgn(0, 0, 0, 0); eRgn(tmpRgn, , , _COPY); Rgn(tmpRgn, -, -); eRgn(hRgn, hRgn, tmpRgn, _AND); Object(tmpRgn); } using (Graphics g = c(memDc)) { RenderNCArea(g, width, height, true); } ClipRgn(hDc, hRgn); eClipRect(hDc, m_rcClient.X, m_rcClient.Y, m_, m_); (hDc, 0, 0, , , memDc, 0, 0, 0x00CC0020/*SRCCOPY*/ ); Object(memDc, hObj); Object(hBmp); } DC(memDc); } DC(hDc); } IntPtr hTmp = RectRgn(m_, m_, m_, m_); if (hTmp != ) { eRgn(hRgn, hRgn, hTmp, _AND); Rgn(hRgn, , ); Object(hTmp); Message msg = new Message();
Message msg = new Message(); = ; = ; = hRgn; c(ref msg); } Object(hRgn); } = ; } private void RenderNCArea(Graphics g, int width, int height, bool bDrawBorder) { Rectangle rc = new Rectangle(0, 0, width, height); using (Brush brush = new SolidBrush(lor)) { ctangle(brush, 0, 0, width, height); } if (bDrawBorder) { DrawBorders(rc, g); } } private void DrawBorders(Rectangle rc, Graphics g) { rder(g, rc, Color, ); }}public class NativeMethods{ internal const int WS_EX_CLIENTEDGE = 512 /*0x0200*/; internal const int WS_EX_WINDOWEDGE = 0x0100; internal const int WM_PAINT = 15; // 0x000f internal const int WM_NCPAINT = 133; // 0x0085 internal const int RGN_AND = 1; internal const int RGN_OR = 2; internal const int RGN_XOR = 3; internal const int RGN_DIFF = 4; internal const int RGN_COPY = 5; [StructLayout(tial)] public struct RECT { public int left; public int top; public int right; public int bottom; public RECT(Rectangle rect) { = ; = ; = ; = ; }
} public RECT(int left, int top, int right, int bottom) { = bottom; = left; = right; = top; } public static RECT FromXYWH(int x, int y, int width, int height) { return new RECT(x, y, x + width, y + height); } public int Width { get { return - ; } } public int Height { get { return - ; } } public override /*Object*/ string ToString() { return ( "Left = ", , " Top ", , " Right = ", , " Bottom = ", ); } public static implicit operator Rectangle(RECT rect) { return RB(, , , ); } } [DllImport("")] internal static extern bool GetWindowRect(IntPtr hwnd, ref RECT lpRect); [DllImport("", CharSet = , ExactSpelling = true, CallingConvention = )] internal static extern IntPtr CreateRectRgn(int x1, int y1, int x2, int y2); [DllImport("", CharSet = , ExactSpelling = true, CallingConvention = )] internal static extern IntPtr GetWindowDC(IntPtr hWnd); [DllImport("", CharSet = , ExactSpelling = true, CallingConvention = )] internal static extern IntPtr CreateCompatibleDC(IntPtr hDC); [DllImport("", CharSet = , ExactSpelling = true, CallingConvention = )] internal static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int width, int height); [DllImport("gdi32", CharSet = , ExactSpelling = true)]
版权声明:本文标题:C#WinForm自定义控件样式(textBox,comboBox,form,radiob。。。 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1703214097h442520.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论