名前空間: System.Windows.Formsアセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
バージョン情報 : .NET Framework1.0以降
以下は部分コード:
public Form1()
{
// Create the NotifyIcon.
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = new Icon("appicon.ico");
// The ContextMenu property sets the menu that will
// appear when the systray icon is right clicked.
notifyIcon1.ContextMenu = this.contextMenu1;
// The Text property sets the text that will be displayed,
// in a tooltip, when the mouse hovers over the systray icon.
notifyIcon1.Text = "Form1 (NotifyIcon example)";
notifyIcon1.Visible = true;
// Handle the DoubleClick event to activate the form.
notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
}
private void notifyIcon1_DoubleClick(object Sender, EventArgs e) {
// Show the form when the user double clicks on the notify icon.
// Set the WindowState to normal if the form is minimized.
if (this.WindowState == FormWindowState.Minimized)
this.WindowState = FormWindowState.Normal;
// Activate the form.
this.Activate();
}
http://homepage1.nifty.com/rucio/main/dotnet/ClassLibrary/L004_System.Windows.Forms.NotifyIcon.htm
0 件のコメント:
コメントを投稿