WinForm中,屏蔽关闭按钮
来源:互联网 发布:黑客论坛网站源码 编辑:程序博客网 时间:2024/05/02 18:48
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
internal static extern IntPtr GetSystemMenu(IntPtr hwnd, bool bRevert);
internal static extern IntPtr GetSystemMenu(IntPtr hwnd, bool bRevert);
[DllImport("user32.dll")]
internal static extern int GetMenuItemCount(IntPtr hMenu);
internal static extern int GetMenuItemCount(IntPtr hMenu);
[DllImport("user32.dll")]
internal static extern int RemoveMenu(IntPtr hMenu, int uPosition, int uFlags);
internal static extern int RemoveMenu(IntPtr hMenu, int uPosition, int uFlags);
private void Form1_Load(object sender, EventArgs e)
{
{
CloseButtonEnable();
}
///<summary>
///「×」ボタンを不可用にする
///</summary>
private void CloseButtonEnable()
{
const int MF_BYPOSITION = 0x00000400;
///「×」ボタンを不可用にする
///</summary>
private void CloseButtonEnable()
{
const int MF_BYPOSITION = 0x00000400;
IntPtr hWindow = this.Handle;
IntPtr hMenu = GetSystemMenu(hWindow, false);
int count = GetMenuItemCount(hMenu);
RemoveMenu(hMenu, count - 1, MF_BYPOSITION);
RemoveMenu(hMenu, count - 2, MF_BYPOSITION);
}
IntPtr hMenu = GetSystemMenu(hWindow, false);
int count = GetMenuItemCount(hMenu);
RemoveMenu(hMenu, count - 1, MF_BYPOSITION);
RemoveMenu(hMenu, count - 2, MF_BYPOSITION);
}
- WinForm中,屏蔽关闭按钮
- WinForm 窗体屏蔽关闭按钮事件
- WinForm 中禁用窗体的关闭按钮
- 如何屏蔽关闭按钮
- 屏蔽关闭按钮
- 屏蔽窗体关闭按钮
- WinForm中的关闭按钮
- 重写winform关闭按钮
- WinForm禁用关闭按钮
- Eclipse RCP中编辑器(editpart)关闭按钮的屏蔽方法
- Eclipse RCP中编辑器(editpart)关闭按钮的屏蔽方法
- C# 屏蔽窗体关闭按钮
- Delphi屏蔽标题栏关闭按钮
- 屏蔽窗体右上角关闭按钮
- C#控制台屏蔽关闭按钮
- 在Winform中禁用窗体的关闭按钮
- WinForm窗体禁用关闭按钮
- WinForm窗体禁用关闭按钮
- 【转】标准C++的类型转换符:static_cast、dynamic_cast、reinterpret_cast和const_cast
- java 面试中的一道截取字符串的经典题目
- JSP中文乱码
- Linux下PHP支持MSSQL(SQL Server2000)
- I always go address
- WinForm中,屏蔽关闭按钮
- postfix sasl身份验证
- 开张了
- 未婚男子健康生活100条感悟
- 心情不好 吃点“快乐食物”
- 使用Windows Live Writer写博客
- 晒晒76的一个朋友在北京月入7000的生活
- IIS的设置
- 简单法抗电脑辐射