[ vb 2008 ] 사용자 컨트롤 매핑 본문

[PL]/VB & VB.NET

[ vb 2008 ] 사용자 컨트롤 매핑

객과 함께. 2009. 12. 31. 22:04

SplitContainer 컨트롤 , TableLayoutPanel컨트롤 과 사용자 컨트롤과 매핑시키기


    Private m_ImageDGV As UserControl1
    Private m_ImageDGY2 As UserControl2
    Private m_ImageDGY3 As UserControl3
    Private m_ImageDGY4 As UserControl4
  
    Private Sub UserControl(ByVal ctl As UserControl)

         Static VisibleControl As UserControl

        ' Panel leeren
        If Me.SplitContainer1.Panel2.Controls.Count > 0 Then
            VisibleControl.Dispose()
        End If

        ' UserControl in das Panel hosten
        ctl.Dock = DockStyle.Fill
        Me.SplitContainer1.Panel2.Controls.Add(ctl)

        ' Aktuelles Control merken
        VisibleControl = ctl

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        m_ImageDGV = New UserControl1
        Me.UserControl(m_ImageDGV)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        m_ImageDGY2 = New UserControl2
        Me.UserControl(m_ImageDGY2)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        m_ImageDGY3 = New UserControl3
        Me.UserControl(m_ImageDGY3)
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        m_ImageDGY4 = New UserControl4
        Me.UserControl(m_ImageDGY4)
    End Sub

'[PL] > VB & VB.NET' 카테고리의 다른 글

[ vb 2008 ] WPF 예제  (0) 2010.01.02
[ vb 2008 ] ImageList 예제  (0) 2010.01.01
[ vb 2008 ] ListView 예제.  (0) 2009.12.30
[ VB.NET ] OpenFileDialog 예제   (0) 2009.12.29
[vb 2008]Try Catch 정리  (0) 2009.12.24