110,568
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Tag = this;//传递Form1
f2.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 f1 = (Form1)this.Tag;//获取Form1对象
f1.Hide();
}
}
}
[DllImport("user32.dll")]
public static extern bool ShowWindow
(
IntPtr hWnd,
int nCmdShow
);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public const int SW_HIDE = 0; /// Hide the window.
ShowWindow(FindWindow(null, "TestFunctions"), SW_HIDE);
TestForm testform = new TestForm();
testform.Show();
this.Hide();
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WordMatching
{
public partial class Login : Form
{
AddPicWaterMark pwm = null;
public Login()
{
InitializeComponent();
}
public Login(AddPicWaterMark waterMark)
{
pwm = waterMark;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
pwm.Close(); ///这样就可以了
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WordMatching
{
public partial class AddPicWaterMark : Form
{
public AddPicWaterMark()
{
InitializeComponent();
}
private void btn_View_Click(object sender, EventArgs e)
{
Login lg = new Login(this);
lg.Show();
}
}
}