Results 1 to 5 of 5

Thread: Resizing a form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    LewZer-LanD
    Posts
    120

    Talking

    Ok.. i have seen a lot of controls that can do what i'm about to explain, but i dont really like controls because they are a pain in the azz to distribute.

    Anywayz... How can i make it so my form can be resized no smaller than lets say... 1000x1000twips and no bigger than 10000x10000twips? or make it so there is no "max" size limit.

    Thanx a lot!
    Kid A

    18 Year Old Programmer
    Visual Basic 6 & .NET Enterprise, ASP, WinXP (Advanced Server) Administration, HTML, Graphic Arts, Winsock, Learning VC++ and now maybe C#.. heh
    [vbcode]
    'back in the day vb6 code
    Private Sub My_Life()
    If Hour(Now) > 3 And Hour(Now) < 13 Then
    Status = "Sleeping"
    Else
    Status = "Computing"
    End If
    End Sub
    [/vbcode]

  2. #2
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373

    Talking How about this.

    Try this in a new form:

    Code:
    Option Explicit
    Dim MinHgt%, MinWdt%, MaxHgt%, MaxWdt%
    
    Private Sub Form_Load()
        MinHgt = 1000
        MinWdt = 1000
        MaxHgt = 10000
        MaxWdt = 10000
    End Sub
    
    Private Sub Form_Resize()
        If Form1.Height < MinHgt Then Form1.Height = MinHgt
        If Form1.Height > MaxHgt Then Form1.Height = MaxHgt  'Remove for no MaxHeight
        If Form1.Width < MinWdt Then Form1.Width = MinWdt
        If Form1.Width > MaxWdt Then Form1.Width = MaxWdt   'Remove for no MaxWidth
    End Sub
    Saludos...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    LewZer-LanD
    Posts
    120

    Thumbs down

    Thank you so much.. but i already knew how to do that.. have u ever tried it?? once the form gets past the "small" size it flickers between sizes.. that vb code sux.. i was hoping for sum API calls.. and i do know that they exsist.


    Please help!!
    Kid A

    18 Year Old Programmer
    Visual Basic 6 & .NET Enterprise, ASP, WinXP (Advanced Server) Administration, HTML, Graphic Arts, Winsock, Learning VC++ and now maybe C#.. heh
    [vbcode]
    'back in the day vb6 code
    Private Sub My_Life()
    If Hour(Now) > 3 And Hour(Now) < 13 Then
    Status = "Sleeping"
    Else
    Status = "Computing"
    End If
    End Sub
    [/vbcode]

  4. #4
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373

    Question Don't Happend to meż?

    I'm sorry that didn't help you, but with me there where no problems, not even with labels or command buttons.

    I use VB6 (SP4)

    Saludos...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  5. #5
    Guest
    You've got to be a bit tricky when resizing the form in the form resize event, cos changing the size raises the resize event, and you enter a recursive loop. You need to flag when you enter the resize loop for the first time, so that you can control whathappens when you re-enter the flag aftyer resizes the form in the resize event.

    (I got distracted for about a hour while I was writng this, so I apologise if this is a repeat of anotehr post)

    - gaffa

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