C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト


(過去ログ 94 を表示中)
■56153 / )  Re[2]: ToolStripMenuItemをクリックで閉じない方法
□投稿者/ shu (337回)-(2010/12/30(Thu) 12:35:12)
No56152 (オショウ さん) に返信

VBですがこんな感じでどうでしょう?
アイテムクリックで閉じたらまた開く処理です。


Private m_blnOpen As Boolean = False

Private Sub ToolStripDropDownButton1_DropDownOpened(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripDropDownButton1.DropDownOpened
m_blnOpen = False
End Sub

Private Sub ToolStripDropDownButton1_DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStripDropDownButton1.DropDownItemClicked
m_blnOpen = True
End Sub

Private Sub ToolStripDropDownButton1_DropDownClosed(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripDropDownButton1.DropDownClosed
If m_blnOpen Then
BackgroundWorker1.RunWorkerAsync()
End If
End Sub

Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
ToolStripDropDownButton1.ShowDropDown()
End Sub
返信 編集キー/


管理者用

- Child Tree -