Results 1 to 4 of 4

Thread: VB Snippet - Limit Form Resize

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    VB Snippet - Limit Form Resize

    VB Code:
    1. '*******************************************************************************
    2. ' MODULE:       Form1
    3. ' AUTHOR:       Speedy
    4. '
    5. ' DESCRIPTION:
    6. ' LIMIT FORM RESIZE EXAMPLE
    7. ' YOU WILL NEED TO HANDLE THE FLICKERING EFFECT !!!
    8.  '*******************************************************************************
    9.  
    10. Option Explicit
    11.  
    12.  '*******************************************************************************
    13. ' Form_Load (SUB)
    14. '
    15. ' DESCRIPTION:
    16. ' ACTION ON FORM LOAD
    17.  '*******************************************************************************
    18.  
    19. Private Sub Form_Load()
    20.    
    21.     '  RESIZE THE FORM
    22.    
    23.     Call Form_Resize
    24.    
    25. End Sub
    26.  
    27.  
    28.  '*******************************************************************************
    29. ' Form_Resize (SUB)
    30. '
    31. ' DESCRIPTION:
    32. ' ACTION ON RESIZE OF FORM
    33.  '*******************************************************************************
    34.  
    35. Private Sub Form_Resize()
    36.    
    37.     On Error Resume Next
    38.    
    39.     Dim WMIN As Double, HMIN As Double
    40.    
    41.     WMIN = 2500
    42.    
    43.     HMIN = 2500
    44.    
    45.     If Me.Width <= WMIN Then
    46.        
    47.         ' DO NOT ALLOW WIDTH TO BE SET BELOW MINIMUM
    48.        
    49.         Me.Width = WMIN
    50.        
    51.     End If
    52.    
    53.     If Me.Height <= HMIN Then
    54.        
    55.         ' DO NOT ALLOW WIDTH TO BE SET BELOW MINIMUM
    56.        
    57.         Me.Height = HMIN
    58.        
    59.     End If
    60.    
    61. End Sub
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  2. #2
    Fanatic Member seec77's Avatar
    Join Date
    Jan 2003
    Posts
    596
    it would be way better to sub-class the form, then, you can limit the size before the drawing is done!
    Best Regards,
    seec77

    If you helped me, cosinder yourself thanked.

    Get each and every Garfield strip here!
    Here you can get all Calvin & Hobes strips!
    Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!

    I am 33% addicted to Counterstrike. What about you?
    I am 23% addicted to Star Wars. What about you?
    I am 0% addicted to Tupac. What about you?

  3. #3
    Lively Member
    Join Date
    Nov 2002
    Location
    Perth - Australia
    Posts
    105
    i use something similiar to that... but how do you stop for form from flickering???

    it is a real pain...

    Cheers

  4. #4
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148
    Search this site for WM_SIZING - there are numeruous examples of flicker-free resize control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width