NotifyIcon.Click 이벤트

정의

알림 영역에 있는 아이콘을 마우스 오른쪽 단추로 클릭할 때 발생합니다.

public:
 event EventHandler ^ Click;
public event EventHandler Click;
public event EventHandler? Click;
member this.Click : EventHandler 
Public Custom Event Click As EventHandler 

이벤트 유형

예제

다음 코드 예제에서는 처리 된 Click 이벤트입니다. 이 예제에서는 라는 NotifyIcon1개체가 포함된 양식에 코드를 추가한 NotifyIcon 것으로 가정합니다.

// Initialize 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 );
}
// Initialize 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);
}
' Initialize 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

설명

이벤트를 처리 하는 방법에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.

적용 대상

추가 정보