作者don750421 (1+1≠2)
看板C_Sharp
标题[问题] 程式常驻右下角失败..
时间Tue Nov 8 19:50:30 2011
小弟今天又有不一样的问题了..
今天试着写将程式常驻於工具列右下角
也上网照一些范例写,但是还是失败...
不晓得是不是因为我作业系统是Windows 7,所以还是常驻於下方工具列
没办法常驻於右下角??
可是我有去download别人写的程式,一样可以常驻於右下角啊....
请问我有那里写错了吗?
namespace Text123
{
public partial class Form1 : Form
{
//宣告NotifyIcon
private System.Windows.Forms.NotifyIcon notifyIcon1;
public Form1()
{
InitializeComponent();
//指定使用的容器
this.components = new System.ComponentModel.Container();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
//点Icon两下执行此动作
this.notifyIcon1.MouseDoubleClick += new
System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick);
//建立NotifyIcon
this.notifyIcon1.Icon = new Icon("Dicon.ico");
this.notifyIcon1.Text = "Test123";
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
this.notifyIcon1.Visible = true;
}
}
/// 当使用者按下提示图示时 , 将视窗显示并且恢复为正常大小
private void notifyIcon1_MouseDoubleClick(object sender, EventArgs e)
{
//让Form再度显示,并写状态设为Normal
// this.NotifyIcon_Tip.Visible = false; // 关闭右下角图案
this.Show();
this.Opacity = 100;
this.Visible = true;
this.WindowState = FormWindowState.Normal;
}
}
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.47.29.229
※ 编辑: don750421 来自: 114.47.29.229 (11/08 19:52)
1F:→ kuroha927:你把Form1_SizeChanged的码写在Form1_Resize里面试试 11/08 22:52
2F:→ don750421:k大,贴了还是无法缩到右下角 11/08 22:56
3F:→ yeo1987:ShowInTaskbar 没设定? 11/09 00:38
4F:→ don750421:解决了,结果是我控制项没拉到@@ 11/09 22:37