文件名称:winform标题栏自定义样式
文件大小:15KB
文件格式:DOCX
更新时间:2015-03-12 14:04:15
winform标题栏
#region 改变窗口样式 #if !DEBUG [DllImport ("User32.dll")] private static extern IntPtr GetWindowDC(IntPtr hwnd); [DllImport ("User32.dll")] private static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc); protected override void WndProc(ref Message m) ...{ base.WndProc(ref m); switch(m.Msg) ...{ case 0x86://WM_NCACTIVATE goto case 0x85; case 0x85://WM_NCPAINT ...{ IntPtr hDC = GetWindowDC(m.HWnd); //把DC转换为.NET的Graphics就可以很方便地使用Framework提供的绘图功能了 Graphics gs = Graphics.FromHdc(hDC); 处理色彩#region 处理色彩 int ibox = 1; if (this.MaximizeBox) ibox ++; if (this.MinimizeBox) ibox ++; //得到相关背景图片 Image imgpm = Image.FromFile( Application.StartupPath+ @"Main.bmp");