NotifyIcon.Click イベントとは? わかりやすく解説

NotifyIcon.Click イベント

通知領域アイコンクリックする発生します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説
使用例使用例

Click イベント処理するコード例次に示します。この例では、NotifyIcon1 という名前の NotifyIcon オブジェクト配置されているフォームコード追加したことを前提としています。

' Initalize the NofifyIcon object's shortcut menu.
Private Sub InitializeContextMenu()
    Dim menuList() As MenuItem = New
 MenuItem() _
                {New MenuItem("Sign In"), New
 MenuItem("Get Help"), _
                New MenuItem("Open")}
    Dim clickMenu As New
 ContextMenu(menuList)
    NotifyIcon1.ContextMenu = clickMenu
End Sub


' When user clicks the left mouse button display the shortcut menu.
  
' Use the SystemInformation.PrimaryMonitorMaximizedWindowSize property
' to place the menu at the lower corner of the screen.
Private Sub NotifyIcon1_Click(ByVal
 sender As Object, _
    ByVal e As System.EventArgs) Handles
 NotifyIcon1.Click

    Dim windowSize As System.Drawing.Size =
 _
        SystemInformation.PrimaryMonitorMaximizedWindowSize
    Dim menuPoint As System.Drawing.Point =
 New System.Drawing.Point _
        (windowSize.Width - 180, windowSize.Height - 5)
    menuPoint = Me.PointToClient(menuPoint)

    NotifyIcon1.ContextMenu.Show(Me, menuPoint)
End Sub
// Initalize the NofifyIcon object's shortcut menu.
private void InitializeContextMenu()
{
    MenuItem[] menuList = new MenuItem[]{new
 MenuItem("Sign In"),
        new MenuItem("Get Help"), new
 MenuItem("Open")};
    ContextMenu clickMenu = new ContextMenu(menuList);
    NotifyIcon1.ContextMenu = clickMenu;

    // Associate the event-handling method with 
    // the NotifyIcon object's click event.
    NotifyIcon1.Click +=new System.EventHandler(NotifyIcon1_Click);
}


// When user clicks the left mouse button display the shortcut menu.
  
// Use the SystemInformation.PrimaryMonitorMaximizedWindowSize property
// to place the menu at the lower corner of the screen.
private void NotifyIcon1_Click(object sender,
 System.EventArgs e)
{
    System.Drawing.Size windowSize = 
        SystemInformation.PrimaryMonitorMaximizedWindowSize;
    System.Drawing.Point menuPoint = 
        new System.Drawing.Point(windowSize.Width-180, 
        windowSize.Height-5);
    menuPoint = this.PointToClient(menuPoint);

    NotifyIcon1.ContextMenu.Show(this, menuPoint);
    
}
// Initalize the NofifyIcon object's shortcut menu.
void InitializeContextMenu()
{
   array<MenuItem^>^menuList = {gcnew MenuItem( "Sign In" ),gcnew
 MenuItem( "Get Help" ),gcnew MenuItem( "Open" )};
   System::Windows::Forms::ContextMenu^ clickMenu = gcnew System::Windows::Forms::ContextMenu(
 menuList );
   NotifyIcon1->ContextMenu = clickMenu;
   
   // Associate the event-handling method with 
   // the NotifyIcon object's click event.
   NotifyIcon1->Click += gcnew System::EventHandler( this,
 &Form1::NotifyIcon1_Click );
}

// When user clicks the left mouse button display the shortcut menu.
  
// Use the SystemInformation.PrimaryMonitorMaximizedWindowSize property
// to place the menu at the lower corner of the screen.
void NotifyIcon1_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
{
   System::Drawing::Size windowSize = SystemInformation::PrimaryMonitorMaximizedWindowSize;
   System::Drawing::Point menuPoint = System::Drawing::Point( windowSize.Width -
 180, windowSize.Height - 5 );
   menuPoint = this->PointToClient( menuPoint );
   NotifyIcon1->ContextMenu->Show( this, menuPoint );
}
// Initalize the NotifyIcon object's shortcut menu.
private void InitializeContextMenu()
{
    MenuItem menuList[] = new MenuItem[] {
        new MenuItem("Sign In"), new
 MenuItem("Get Help"),
        new MenuItem("Open") };
    ContextMenu clickMenu = new ContextMenu(menuList);
    notifyIcon1.set_ContextMenu(clickMenu);
    // Associate the event-handling method with 
    // the NotifyIcon object's click event.
    notifyIcon1.add_Click(new System.EventHandler(notifyIcon1_Click));
} //InitializeContextMenu

// When user clicks the left mouse button display the shortcut menu.
  
// Use the SystemInformation.PrimaryMonitorMaximizedWindowSize property
// to place the menu at the lower corner of the screen.
private void notifyIcon1_Click(Object sender,
 System.EventArgs e)
{
    System.Drawing.Size windowSize =
        SystemInformation.get_PrimaryMonitorMaximizedWindowSize();
    System.Drawing.Point menuPoint =
        new System.Drawing.Point(windowSize.get_Width() - 180
,
        windowSize.get_Height() - 5);
    menuPoint = this.PointToClient(menuPoint);

    notifyIcon1.get_ContextMenu().Show(this, menuPoint);
} //notifyIcon1_Click 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からNotifyIcon.Click イベントを検索した結果を表示しています。
Weblioに収録されているすべての辞書からNotifyIcon.Click イベントを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からNotifyIcon.Click イベント を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「NotifyIcon.Click イベント」の関連用語

NotifyIcon.Click イベントのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



NotifyIcon.Click イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS