[vb.net] 마우스 드레그로 컨트롤 사이즈 변경 / 영역 사이즈 변경 > vb.net

본문 바로가기

vb.net

[Mouse] [vb.net] 마우스 드레그로 컨트롤 사이즈 변경 / 영역 사이즈 변경

회원사진
하나를하더라도최선을
2022-10-09 22:26 2,436 0

본문



    Private Sub Panel_x_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel9.MouseDown, Panel8.MouseDown, Panel7.MouseDown
        If sender Is Panel9 Then
            Windows.Forms.Cursor.Current = Cursors.HSplit
        Else
            Windows.Forms.Cursor.Current = Cursors.VSplit
        End If
        DirectCast(sender, Panel).Tag = {1, e.X, e.Y}
    End Sub
 
    Private Sub Panel_x_MouseUp(sender As Object, e As MouseEventArgs) Handles Panel9.MouseUp, Panel8.MouseUp, Panel7.MouseUp
        Windows.Forms.Cursor.Current = Cursors.Default
        sender.Tag = Nothing
    End Sub
 
    Private Sub Panel_x_MouseMove(sender As Object, e As MouseEventArgs) Handles Panel9.MouseMove, Panel8.MouseMove, Panel7.MouseMove
        If sender.Tag Is Nothing Then Return
        Dim PN As Panel = DirectCast(sender, Panel)
        Dim P() As Integer = PN.Tag
        If PN Is Panel7 Then
            Panel2.Width += P(1- e.X
        ElseIf PN Is Panel8 Then
            Panel1.Width += e.X - P(1)
        ElseIf PN Is Panel9 Then
            Panel4.Height += P(2- e.Y
        End If
    End Sub




    Private Sub Panel_x_MouseMove(sender As Object, e As MouseEventArgs) Handles pn_2.MouseMove, pn_1.MouseMove
        If sender Is pn_1 Then
            Windows.Forms.Cursor.Current = Cursors.VSplit
        Else
            Windows.Forms.Cursor.Current = Cursors.HSplit
        End If
        If sender.Tag Is Nothing Then Return
        Dim PN As Panel = DirectCast(sender, Panel)
        Dim P() As Integer = PN.Tag
        If PN Is pn_1 Then
            GroupBox9.Width += e.X - P(1)
        ElseIf PN Is pn_2 Then
            GroupBox10.Height += e.Y - P(2)
        End If
    End Sub

댓글목록0

등록된 댓글이 없습니다.
게시판 전체검색