Need resize events, not minimise/restore?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • null

    Need resize events, not minimise/restore?

    Hello
    I have a listbox in my form, which I want to clear if the form's
    hieght changes. I am having difficulty with that, as it seems
    when the form is minimised the height changes, this is not
    what I need, I need only changes to non minimised sizes, i.e.
    when the user uses the mouse to increase the size?


  • Teme64

    #2
    Re: Need resize events, not minimise/restore?

    null wrote:
    Hello
    I have a listbox in my form, which I want to clear if the form's
    hieght changes. I am having difficulty with that, as it seems
    when the form is minimised the height changes, this is not
    what I need, I need only changes to non minimised sizes, i.e.
    when the user uses the mouse to increase the size?
    >
    >
    Check WindowState:

    Private Sub Form1_Resize(By Val sender As Object, ByVal e As System.EventArg s) Handles Me.Resize
    '
    If Not Me.WindowState = FormWindowState .Minimized Then
    ListBox1.Items. Clear()
    End If

    End Sub

    However, with the code above ListBox gets cleared when the minimized form is restored. If you
    do not want to clear ListBox when the form is restored:

    Private g_IsRestoreNext ResizeEvent As Boolean

    Private Sub Form1_Resize(By Val sender As Object, ByVal e As System.EventArg s) Handles Me.Resize
    '
    If Me.WindowState = FormWindowState .Minimized Then
    g_IsRestoreNext ResizeEvent = True
    ElseIf g_IsRestoreNext ResizeEvent Then
    g_IsRestoreNext ResizeEvent = False
    Else
    ListBox1.Items. Clear()
    End If

    End Sub

    Hope this helps.

    --

    Teme64 @ http://windevblog.blogspot.com

    Comment

    • null

      #3
      Re: Need resize events, not minimise/restore?

      perfectly, yes!!


      Comment

      Working...