视觉基本mdi安排不运作

时间:2017-01-04 02:13:55

标签: vb.net visual-studio-2010

我使用visual studio 2010和.NET Framework版本是4.6。 我想安排mdi儿童表格。例如,水平,垂直,级联.. 所以我搜索了信息,我编写了代码,但没有运行。救救我..

我使用mdi格式的MenuStrip,我的代码是

Private Sub Windows_DropDownItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles Windows.DropDownItemClicked
    Dim sMenuItem As String

    sMenuItem = e.ClickedItem.Name

    If sMenuItem = "CascadeMenuItem" Then
        Me.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade)
    ElseIf sMenuItem = "HorizontalMenuItem" Then
        Me.LayoutMdi(System.Windows.Forms.MdiLayout.TileHorizontal)
    ElseIf sMenuItem = "VerticalMenuItem" Then
        Me.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical)
    End If
End Sub

提前致谢..

1 个答案:

答案 0 :(得分:0)

我会与实际控件进行比较,而不是使用他们的名字:

Private Sub Windows_DropDownItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles Windows.DropDownItemClicked
    If e.ClickedItem Is CascadeMenuItem Then
        Me.LayoutMdi(MdiLayout.Cascade)
    ElseIf e.ClickedItem Is HorizontalMenuItem Then
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    ElseIf e.ClickedItem Is VerticalMenuItem Then
        Me.LayoutMdi(MdiLayout.TileVertical)
    End If
End Sub

除此之外,不确定还有什么可能是错的。你能展示一下表格的截图吗?