I sometimes try to find an out of the question answer to things and here is today's question.

We have Form1, on form one there is Panel1 set at a size of 72, 56 with a diffrent colored background to see the effects. Now, take the code below and walah.... something pretty nifty happens.

My question is this: how can a minimum and maximum size be set for the Panel? The code works great but you can expand the Panel as far as your form can reach and you can also shrink the Panel till it dissapears away completely. It needs to have some limits set so it won't go on forever and a day and so that you can't cause it to evaporate into nothing.

Great minds are encouraged to throw thoughts or examples my way cause I need help more than I have been able to get so far. ROFLMAO

Code:

Private Sub Panel1_MouseMove(ByVal sender As Object, _
      ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove



        If _mouseDown = True Then
            Panel1.Width = e.X
        Else

            If e.X >= Panel1.Width - 3 Then
                Panel1.Cursor = Cursors.VSplit
            Else
                Panel1.Cursor = Me.Cursor
            End If

        End If

    End Sub

    Private Sub Panel1_MouseDown(ByVal sender As Object, _
      ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown

        _mouseDown = True
        Panel1.Cursor = Cursors.VSplit
    End Sub

    Private Sub Panel1_MouseUp(ByVal sender As Object, _
      ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp

        _mouseDown = False
        Panel1.Cursor = Me.Cursor
    End Sub