winform 窗体之间切换
来源:互联网 发布:云数据库工程师要求 编辑:程序博客网 时间:2024/04/29 23:57
[DllImport("user32.dll", EntryPoint = "FindWindow")]
public static extern int b(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern int a(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
//点击picturebox事件触发 窗体打开
private void pictureBox2_Click(object sender, EventArgs e)
{
OA fm = new OA();
if (Context.IsHasOpen("OA"))
{
a(b(null, "OA"), -1, 0, 0, 0, 0, 0x001 | 0x002 | 0x040);
a(b(null, "Test2"), -2, 0, 0, 0, 0, 0x001 | 0x002 | 0x040);
}
else
{
if (Context.OpenForm.Length > 0)
{
Context.OpenForm += ",";
}
Context.OpenForm += "OA";
fm.Show();
}
}
private void pictureBox3_Click(object sender, EventArgs e)
{
Test2 f = new Test2();
if (Context.IsHasOpen("Test2"))
{
a(b(null, "Test2"), -1, 0, 0, 0, 0, 0x001 | 0x002 | 0x040);
a(b(null, "OA"), -2, 0, 0, 0, 0, 0x001 | 0x002 | 0x040);
}
else
{
if (Context.OpenForm.Length > 0)
{
Context.OpenForm += ",";
}
Context.OpenForm += "Test2";
f.Show();
}
}
//Content 类
public class Context
{
public static string OpenForm = "";
//记录打开窗体名称
public static bool IsHasOpen(string newForm)
{
bool bR = false;
string[] arrylist = OpenForm.Split(',');
if (arrylist.Length > 0)
{
foreach (string str in arrylist)
{
if (newForm == str)
{
bR = true;
break;
}
else
{
bR = false;
}
}
}
return bR;
}
//窗体关闭触发此事件,清除对应窗体名称
public static string DeleteOpenFrom(string strForm)
{
string[] arrylist = OpenForm.Split(',');
if (arrylist.Length > 0)
{
OpenForm = "";
foreach (string str in arrylist)
{
if (strForm == str)
{
}
else
{
if (OpenForm.Length <= 0)
{
OpenForm += str;
}
else
{
OpenForm += "," + str;
}
}
}
}
return OpenForm;
}
}
- winform 窗体之间切换
- WinForm窗体之间操作
- winform两个窗体的切换
- WinForm窗体之间参数传递
- WinForm窗体之间传值
- WinForm窗体之间传递参数
- WinForm窗体之间传值
- Winform窗体之间传值
- 两个winform窗体之间的传值
- 窗体之间传值(winform)-----源码
- C# WinForm(窗体) 之间传值
- WinForm窗体之间的传值
- WinForm窗体之间交互的一些方法
- WinForm窗体之间交互的一些方法
- WinForm窗体之间数据传递的方法
- Winform不用窗体之间传值
- C# WinForm(窗体) 之间传递变量
- Winform窗体之间的传值
- 用jquery生成二级菜单
- oracle中报ora-01033:oracle initializationg or shutdown in progress错
- ZK 6.5 与 SpringSecurity 3.1 在Maven下的整合
- 中国国家气象局天气预报信息接口
- get 和 post
- winform 窗体之间切换
- WinFrom窗体属性
- PERL web server configration
- Android的WebView控件载入网页显示速度慢的究极解决方案
- UriMatcher理解
- SD/USB .
- android String equal 和 ==的区别
- C#WinForm仿qq窗体拖到windows窗体边上时,自动隐藏C#WinForm
- 查看oracle连接