覆盖面板与另一个

时间:2017-07-28 03:07:59

标签: vb.net

Private Sub frmitem_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    pnldeposit.Visible = False
    pnlwithdraw.Visible = False
End Sub

Private Sub cmdideposit_Click(sender As Object, e As EventArgs) Handles cmdideposit.Click
    pnldeposit.Visible = True
    pnlwithdraw.Visible = False
End Sub

Private Sub cmdiwithdraw_Click(sender As Object, e As EventArgs) Handles cmdiwithdraw.Click
    pnlwithdraw.Visible = True
    pnldeposit.Visible = False
End Sub

//我对此表单有疑问。我想展示第一个成功的面板,但问题是显示第二个面板。它不工作,我使用按钮顺便说一句。帮我。提前谢谢你:D

2 个答案:

答案 0 :(得分:0)

以下是使用BringToFront的快速示例。两个面板具有相同的位置并且尺寸相同。

Public Class Form1
  Private switchPanels As Boolean
  Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
    switchPanels = Not switchPanels
    If switchPanels Then
        Panel1.BringToFront()
    Else
        Panel2.BringToFront()
    End If
  End Sub
End Class

答案 1 :(得分:0)

Private Sub cmdideposit_Click(sender As Object, e As EventArgs) Handles cmdideposit.Click
    pnldeposit.Visible = True
    pnlwithdraw.Visible = False
    pnlreport.Visible = False
End Sub

Private Sub cmddcancel_Click(sender As Object, e As EventArgs)
    pnldeposit.Hide()
End Sub

Private Sub cmdiwithdraw_Click(sender As Object, e As EventArgs) Handles cmdiwithdraw.Click

    pnlwithdraw.Visible = True
    pnlreport.Visible = False
End Sub

Private Sub cmdwclear_Click(sender As Object, e As EventArgs) Handles cmdwclear.Click
    pnlwithdraw.Visible = False
End Sub

Private Sub cmdireport_Click(sender As Object, e As EventArgs) Handles cmdireport.Click
    pnlreport.Visible = True
End Sub

//谢谢你分享你的想法!我发现它是如何工作的。谢谢! :d