写小程序遇到的问题

1.窗体最小化到任务栏处,主要实现代码如下:

his.Deactivate+=new EventHandler(Form1_Mini);

private void Form1_Mini(object sender, System.EventArgs e)
{
if(this.WindowState==FormWindowState.Minimized)
{
this.Visible=false;
this.notifyIcon1.Visible=true;
}
}

private void notifyIcon1_Click(object sender, System.EventArgs e)
{
this.Visible=true;
this.WindowState=FormWindowState.Normal;
this.Activate();
this.notifyIcon1.Visible=false;
}

2.调用一个窗体,隐藏本窗体


在一个窗体调用另一个窗口:
第一个窗体:frmMain,第二个窗体:frmShow
frmShow:
public static System.Windows .Forms.Form vform=null;
frmShow.vform.Visible =false;

frmMain:
在main函数中写:

frmShow.vform =new frmMain ();
Application.Run (frmShow.vform);

3.实现左右鼠标点击

private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{

//this.notifyIcon1.Visible=false;
if (e.Button ==MouseButtons.Left )
{
this.Visible=true;
this.WindowState=FormWindowState.Normal;
this.Activate();
}
if (e.Button ==MouseButtons.Right )
{
}

}//鼠标的左右键!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值