.Net下去掉MDI窗体内客户区的边框
2007-04-30 12:31
295 查看
.NET下,MDI窗体内客户区的3D边框很难看,下面是我写的一个类,可以去掉这个边框:
using System;
using System.Runtime.InteropServices;
namespace iUNS
{
/// <summary>
/// iuSetMdiClientBorder 的摘要说明。
/// </summary>
public class iuSetMdiClientBorder
{
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int GetWindowLong(int hwnd, int nIndex);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int SetWindowLong(int hwnd, int nIndex, int dwNewLong);
private const int GWL_EXSTYLE = (-20);
private const int WS_EX_CLIENTEDGE = 0x0200;
public iuSetMdiClientBorder()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 设置Mdi窗口客户区是否绘制3D边框
/// </summary>
/// <param name="hWnd">Mdi窗口的Handle</param>
/// <param name="showBorder">是否绘制3D边框</param>
public static void SetMdiClientBorder(int hWnd,bool showBorder)
{
int windowLong = GetWindowLong(hWnd,GWL_EXSTYLE);
if(showBorder)
windowLong = windowLong & WS_EX_CLIENTEDGE;
else
windowLong = windowLong & ~WS_EX_CLIENTEDGE;
SetWindowLong(hWnd, GWL_EXSTYLE, windowLong);
}
}
}
using System;
using System.Runtime.InteropServices;
namespace iUNS
{
/// <summary>
/// iuSetMdiClientBorder 的摘要说明。
/// </summary>
public class iuSetMdiClientBorder
{
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int GetWindowLong(int hwnd, int nIndex);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int SetWindowLong(int hwnd, int nIndex, int dwNewLong);
private const int GWL_EXSTYLE = (-20);
private const int WS_EX_CLIENTEDGE = 0x0200;
public iuSetMdiClientBorder()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 设置Mdi窗口客户区是否绘制3D边框
/// </summary>
/// <param name="hWnd">Mdi窗口的Handle</param>
/// <param name="showBorder">是否绘制3D边框</param>
public static void SetMdiClientBorder(int hWnd,bool showBorder)
{
int windowLong = GetWindowLong(hWnd,GWL_EXSTYLE);
if(showBorder)
windowLong = windowLong & WS_EX_CLIENTEDGE;
else
windowLong = windowLong & ~WS_EX_CLIENTEDGE;
SetWindowLong(hWnd, GWL_EXSTYLE, windowLong);
}
}
}
相关文章推荐
- Mdi窗体客户区无边框显示
- Mdi窗体客户区无边框显示
- C# 如何窗体去掉上面的最大化,最小化合关闭以及实现无边框窗体拖动
- C# 如何窗体去掉上面的最大化,最小化合关闭以及实现无边框窗体拖动【申明:来源于网络】
- 今日问题汇总-WPF中更改Image控件的source、WPF 去掉窗体边框
- .Net创建MDI窗体
- 去掉窗体的边框,并且禁止拖动改变窗体大小
- MFC MDI和SDI非客户区框架界面美化之----标题栏以及边框美化
- .Net:MDI窗体菜单
- 窗体去掉边框后不能拖动的问题
- .Net:MDI窗体菜单,隐藏子窗体ICON图标
- 去掉CFrameWnd窗体的客户区边框
- Winfrom窗体在去掉窗体边框的情况下使鼠标移动窗体
- C#MDI打开子窗体去掉自动生成的菜单栏
- MFC MDI和SDI非客户区框架界面美化之----标题栏以及边框美化
- C#Winform去掉边框后,窗体最大化,任务栏被遮挡问题!
- 测试窗体的FormBorderStyle属性,不同属性所对应的窗体边框显示情况
- Android 去掉 ImageButton 的白色边框
- 去掉谷歌浏览器默认的input、textarea的边框
- 对MDI和SDI非客户区