代码已经做到了,防止重复打开,但是我再重复点击的时候,该窗体不能作为焦点还是最小化在下面 private void add_sell_Click(object sender, EventArgs e)
{ if (add_chuku.sign == false)
{
add_chuku asss = new add_chuku();
asss.MdiParent = this;
add_chuku.sign = true;
asss.ShowDialog();
}
else
{
return;
}
}
{ if (add_chuku.sign == false)
{
add_chuku asss = new add_chuku();
asss.MdiParent = this;
add_chuku.sign = true;
asss.ShowDialog();
}
else
{
return;
}
}
解决方案 »
- c# 多线程 返回值
- TEXTBOX过滤问题
- datagrid控件问题
- datetime格式
- ado.net连接不上Oralce
- 怎样解决不同网段间访问的问题?
- 如何在C#中动态创建Access数据库及表,如何使用,请附加详细的简单例子.谢谢
- 请问vs.net 2003中文版是几张cd?版本号是多少?谢谢
- 欲将DataGrid中(或DataSet中)的数据导出到Excel中,怎样将DataGrid中的数据由cs中传递到aspx文件中或直接在aspx文件中得到DataGrid中的
- CSDN论坛实在太破了,问出来的问题没有多少有效解答
- C# HashTable(急用)
- 怎么监测IE是否启动了,如果启动了就立刻关闭
http://blog.csdn.net/wuyazhe/archive/2010/06/24/5690850.aspx
[DllImport("user32.dll ")]
public static extern void SetForegroundWindow(IntPtr hwnd);
[DllImport("user32.dll ")]
public static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll ")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public static void ActiveiseLoginWindow(string name)
{
Process[] proc = Process.GetProcessesByName(name); foreach (Process p in proc)
{
SetForegroundWindow(p.MainWindowHandle);
ShowWindow(p.MainWindowHandle, 3);
} } [STAThread]
static void Main()
{
bool canCreateNew;
Mutex mutex = new Mutex(true, "工程名", out canCreateNew);
if (!canCreateNew)
{
//throw new Exception("Can create two or more server!");
ActiveiseLoginWindow("工程名"); return;
} Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
mutex.ReleaseMutex();
}
private CustomerManagement.CustomerManger customanger;
private void 客户信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (customanger == null || customanger.IsDisposed)
{
customanger = new AchievementManger.CustomerManagement.CustomerManger();
customanger.MdiParent = this;
customanger.Show();
}
else { customanger.Activate(); }
}
{
asss = new add_chuku();
asss.MdiParent = this;
add_chuku.sign = true;
asss.ShowDialog();
}
else
{
asss.Focus();
return;
}
这个就是判断窗体是否打开的。