窗体不能还原的问题 我想实现QQ那样 窗体拖到边缘可以自动隐藏 鼠标放上去可以显示这些功能已经实现可就是点击最小化以后 不能够还原了 这是什么问题啊! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 QQ 窗口 的 最小化 与关闭,都一样的,你意思是不是 像QQ一样 最小化与关闭,都消失在任务栏中,之后 点击,托盘 后 还原窗口呢?如果想 点击,托盘 后 还原窗口, 最小化与关闭时 用隐藏窗口就可以了, this.Hide();点击,托盘 后 还原窗口 就显示窗口 this.Show(); 我的 农场园丁 就是这样的,不知道,你是不是要这样呢? 如果希望最小化到托盘,点击托盘图标激活窗口,右键图标提示退出程序的话,需要notifyIcon控件。代码如下:public Form1() { InitializeComponent(); //初始化托盘程序的各个要素 Initializenotifyicon(); m_bShowWnd = true; closingFlag = false; }private ContextMenu notifyiconMnu = new ContextMenu();private void Initializenotifyicon() { //定义一个MenuItem数组,并把此数组同时赋值给ContextMenu对象 MenuItem[] mnuItms = new MenuItem[1]; mnuItms[0] = new MenuItem(); mnuItms[0].Text = "退出"; mnuItms[0].Click += new System.EventHandler(this.ExitSelect); mnuItms[0].DefaultItem = true; notifyiconMnu = new ContextMenu(mnuItms); notifyIcon1.ContextMenu = notifyiconMnu; notifyIcon1.BalloonTipText = "Hello World!"; notifyIcon1.BalloonTipTitle = "提示:"; //为托盘程序加入设定好的ContextMenu对象 }public void ExitSelect(object sender, System.EventArgs e) { closingFlag = true; //隐藏托盘程序中的图标 notifyIcon1.Dispose(); //关闭系统 Application.Exit(); } private void Form1_FormClosing(object sender, System.ComponentModel.CancelEventArgs e) { if(closingFlag == false) e.Cancel = true; this.notifyIcon1.Visible = true; this.Hide(); m_bShowWnd = false; notifyIcon1.ShowBalloonTip(10); } private void notifyIcon1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (m_bShowWnd == true) //根据窗口的显示和隐藏设置Trayico对象的显示 { this.Hide(); this.notifyIcon1.Visible = true; m_bShowWnd = false; } else { this.Show(); this.notifyIcon1.Visible = true; m_bShowWnd = true; } if (this.WindowState == FormWindowState.Minimized) this.WindowState = FormWindowState.Normal; this.Activate(); } } 关于hashtable遍历? 请教一个Winform中DataGridView 的问题 有人知道<<C#高级编程>>第四版叫什么名字吗? <*急*>一个网格控件(与信纸稿件相似). 如何读取大批量数据? 一个找工作的问题 请教各位大侠:关于VS.Net的问题 请问一个外企级别的.NET项目经理所需的技能是什么? LinkLabel.LinkClicked事件中有没有办法判断点击的是右键? 怎样在.net c#做的web页代码中控制IE浏览器的某个工具选项的设置,笑送100分! 谁有gmap.net的例子 给我一个啊 谢谢了 Socket问题请教
点击,托盘 后 还原窗口 就显示窗口 this.Show(); 我的 农场园丁 就是这样的,不知道,你是不是要这样呢?
public Form1()
{
InitializeComponent();
//初始化托盘程序的各个要素
Initializenotifyicon();
m_bShowWnd = true;
closingFlag = false;
}private ContextMenu notifyiconMnu = new ContextMenu();
private void Initializenotifyicon()
{
//定义一个MenuItem数组,并把此数组同时赋值给ContextMenu对象
MenuItem[] mnuItms = new MenuItem[1];
mnuItms[0] = new MenuItem();
mnuItms[0].Text = "退出";
mnuItms[0].Click += new System.EventHandler(this.ExitSelect);
mnuItms[0].DefaultItem = true; notifyiconMnu = new ContextMenu(mnuItms);
notifyIcon1.ContextMenu = notifyiconMnu;
notifyIcon1.BalloonTipText = "Hello World!";
notifyIcon1.BalloonTipTitle = "提示:";
//为托盘程序加入设定好的ContextMenu对象 }
public void ExitSelect(object sender, System.EventArgs e)
{
closingFlag = true;
//隐藏托盘程序中的图标
notifyIcon1.Dispose();
//关闭系统
Application.Exit();
}
private void Form1_FormClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
if(closingFlag == false)
e.Cancel = true;
this.notifyIcon1.Visible = true;
this.Hide();
m_bShowWnd = false;
notifyIcon1.ShowBalloonTip(10); } private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (m_bShowWnd == true) //根据窗口的显示和隐藏设置Trayico对象的显示
{
this.Hide();
this.notifyIcon1.Visible = true;
m_bShowWnd = false;
}
else
{
this.Show();
this.notifyIcon1.Visible = true;
m_bShowWnd = true;
}
if (this.WindowState == FormWindowState.Minimized)
this.WindowState = FormWindowState.Normal; this.Activate();
}
}