1

vb6 popupmenu のように動作する vb.net でカスタム コントロールを作成したい & フォーム show dialog のように動作します。動的に入力されるポップアップ メニュー & 私の O/P は popupmenu のクリック イベント結果のみに依存します。

コンテキスト menustrip を使用すると、コンテキスト menustrip を呼び出すフォームのすべてのイベントの後にコンテキスト menustrip のクリック イベントが発生します。したがって、コンテキスト メニューストリップ itemclicked の結果を使用して Mainform でプログラムの残りの部分を続行することはできません。

  1. 私のメインフォームMouseUpが呼び出されます

  2. マウスアップ コンテキスト メニュー内が表示されます

  3. コンテキスト メニューの表示後、メイン フォームの次の行を削除します MouseUp から取得した結果を続行しますContextMenuStrip_ItemClicked

  4. ContextMenuStrip_ItemClickedそれ以外では置き換えられない非常に多くの他の機能とコードがあります

コード:

 Private Sub ChangeLayer(ByRef X As Double, ByRef Y As Double, ByRef D As String, ByRef T As Integer)''*****Change Layer Called in MouseUp Event of MainForm
            Dim A As String
            Dim objDrawingPoint As New Drawing.Point
            Dim cms As New ContextMenuStrip
            DeleteFlag = False
            'A = M_PlaceLayer.Text
            A = PlaceOn.Text
            If T Then
                M_SelLayC(0).Enabled = False : M_SelLayC(1).Enabled = False
                M_SelLayS(16).Enabled = False : M_SelLayS(17).Enabled = False
                CompLayer(0).Enabled = False : CompLayer(1).Enabled = False
                SolderLayer(16).Enabled = False : SolderLayer(17).Enabled = False
            End If
            '' M_PlaceLayer.Text = StrAnsi(D)
            PlaceOn.Text = StrAnsi(D)
            m_LayerFlag = False
            objDrawingPoint = ViewPicture.PointToClient(Cursor.Position)
            With objDrawingPoint

                cm_FO.Show(ViewPicture, New Point(.X, .Y))'''**Context MenuStrip Show() 


            End With

            '''''Depends on Result of ItemClicked of cm_FO contextmenustrip below code works

    '******************************************************

    'Code Below Works with result of Context MenuStrip ItemClicked 

    '******************************************************

    '         M_PlaceLayer.Text = StrAnsi(A)
            PlaceOn.Text = StrAnsi(A)
            If T Then
                M_SelLayC(0).Enabled = True : M_SelLayC(1).Enabled = True
                M_SelLayS(16).Enabled = True : M_SelLayS(17).Enabled = True
                CompLayer(0).Enabled = True : CompLayer(1).Enabled = True
                SolderLayer(16).Enabled = True : SolderLayer(17).Enabled = True
            End If
    '****************************************************
        End Sub
4

0 に答える 0