Mdi窗体客户区无边框显示
2014-10-21 18:11
141 查看
#region 系统API // Win32 Constants private const int GWL_STYLE = -16; private const int GWL_EXSTYLE = -20; private const int WS_BORDER = 0x00800000; private const int WS_EX_CLIENTEDGE = 0x00000200; private const uint SWP_NOSIZE = 0x0001; private const uint SWP_NOMOVE = 0x0002; private const uint SWP_NOZORDER = 0x0004; private const uint SWP_NOREDRAW = 0x0008; private const uint SWP_NOACTIVATE = 0x0010; private const uint SWP_FRAMECHANGED = 0x0020; private const uint SWP_SHOWWINDOW = 0x0040; private const uint SWP_HIDEWINDOW = 0x0080; private const uint SWP_NOCOPYBITS = 0x0100; private const uint SWP_NOOWNERZORDER = 0x0200; private const uint SWP_NOSENDCHANGING = 0x0400; // Win32 方法 [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern int GetWindowLong(IntPtr hWnd, int Index); [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern int SetWindowLong(IntPtr hWnd, int Index, int Value); [DllImport("user32.dll", ExactSpelling = true)] private static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); private void MainForm_Shown(object sender, EventArgs e) { //获取mdi客户区 MdiClient mdiClient = null; for (int i = 0; i < this.Controls.Count; i++) { mdiClient = this.Controls[i] as MdiClient; if (mdiClient != null) { // 找到了mdi客户区 // 取得客户区的边框 int style = GetWindowLong(mdiClient.Handle, GWL_STYLE); int exStyle = GetWindowLong(mdiClient.Handle, GWL_EXSTYLE); style &= ~WS_BORDER; exStyle &= ~WS_EX_CLIENTEDGE; // 调用win32设定样式 SetWindowLong(mdiClient.Handle, GWL_STYLE, style); SetWindowLong(mdiClient.Handle, GWL_EXSTYLE, exStyle); // 更新客户区 SetWindowPos(mdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); UpdateStyles(); break; } } } #endregion
相关文章推荐
- Mdi窗体客户区无边框显示
- .Net下去掉MDI窗体内客户区的边框
- MDI窗体内只显示一个子窗体
- 测试窗体的FormBorderStyle属性,不同属性所对应的窗体边框显示情况
- MDI窗体,子窗体在父窗体中最大化,如果子窗体已经打开则显示,不重复打开窗体
- 子窗体显示在MDI窗体上
- C#Winform无边框窗体如何点击系统任务栏显示和隐藏窗体
- MDI全屏显示窗体
- Flex 多窗体显示 MDI Form
- C#中MDI窗体关闭显示代码搜集整理
- MDI 子窗体最大化时显示
- 借鸡下蛋---MDI窗体显示无对齐属性控件
- C#中MDI窗体关闭显示代码搜集整理
- MDI窗体与子窗体的显示问题--(如何让主窗体是被控件挡住的子窗体显示)
- C#中MDI窗体关闭显示代码
- MDI 子窗体最大化时显示
- 机房收费系统--MDI窗体不能放控件和子窗体不能显示
- 用Qt实现窗体的无边框、可移动、透明不规则显示(需背景透明的图片)
- C#中MDI窗体关闭显示代码搜集整理
- MDI窗体,子窗体在父窗体中最大化,如果子窗体已经打开则显示,不重复打开窗体