看板 C_Sharp 關於我們 聯絡資訊
小弟今天又有不一樣的問題了.. 今天試著寫將程式常駐於工具列右下角 也上網照一些範例寫,但是還是失敗... 不曉得是不是因為我作業系統是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)
kuroha927:你把Form1_SizeChanged的碼寫在Form1_Resize裡面試試 11/08 22:52
don750421:k大,貼了還是無法縮到右下角 11/08 22:56
yeo1987:ShowInTaskbar 沒設定? 11/09 00:38
don750421:解決了,結果是我控制項沒拉到@@ 11/09 22:37