2013-06-26 1 views
1

Powershell로 변환하고 싶지만 어떻게해야할지 잘 모르겠습니다. 중요한 부분은 trayMenu 항목에 대한 처리기를 만드는 것입니다.Powershell에서 contextmenustrip에 대한 처리기를 추가하십시오.

NotifyIcon trayIcon; 
ContextMenuStrip trayMenu; 
trayMenu = new ContextMenuStrip(); 
trayMenu.Items.Add("Login", ContextMenuStripItemImages).Click += new EventHandler(Login_Click); //Create a new item in the context menu strip and link its Click event with Login_Click 
trayIcon = new NotifyIcon(); 
trayIcon.ContextMenuStrip = trayMenu; //Set the ContextMenuStrip of trayIcon to trayMenu 
} 

private void Login_Click(object sender, EventArgs e) 
{ 
    //Do something when Login is clicked 
} 

미리 도움을 청하십시오.

답변

1

그래서 같은

trayMenu.Items.Add("Login", ContextMenuStripItemImages).add_Click({... script here ...}) 

발신자 $_ 의해 $this 전자 (는 EventArgs)로 표현된다.

+0

정말 고마워요. 완벽하게 작동했습니다. :) –

관련 문제