Results 1 to 18 of 18

Thread: Maximising a form?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    131

    Maximising a form?

    Hey, just a bit confused here. Im making a program that runs full screen. The background of the forms fine becuase i can dock it. But on the form i want a picture box, textbox, and a button. When i put them on in the designer they're fine, but when i run the program then click maximise they dont stay in the center and mold to the corner. Is there a way i can keep them where i want them? i dont rreally know how to explain. if someone thinks they know ill try and expalin better xD. Thanks.
    Adam

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Maximising a form?

    they dont stay in the center and mold to the corner.
    I Think you need to handle the form resize event and maximize event to maintain the controls in the center of the form.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Maximising a form?

    Although the language is not specified, all other threads created have been for VB.NET. Moved

  4. #4
    Lively Member
    Join Date
    Jan 2008
    Location
    England
    Posts
    113

    Re: Maximising a form?

    You need to change their Anchor Properties.

  5. #5
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Maximising a form?

    Quote Originally Posted by TGOSeraph View Post
    You need to change their Anchor Properties.
    TGO,
    I like to no more about your comment.
    anchor properties you mean? what the equalant in vb6
    coz i am not using .net

  6. #6
    Lively Member
    Join Date
    Jan 2008
    Location
    England
    Posts
    113

    Re: Maximising a form?

    In that case I cant be any more help, but you prob want to get this topic moved to the VB6 forum

    You might just have to calculate the size of the form, then set the controls coordinates appropriately

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Maximising a form?

    Moved

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    131

    Re: Maximising a form?

    Right, ive set the forms property "window state" to maximised. So now it runs in full screen (no taskbar). I place things where i want on the design part of the form and it all looks fine. but when the programs ran it goes to full screen so all the things that were on the designer page go to the left hand top corner of the screen. so its not in proportion. I think ive tried the anchor property to no avail. Oh and Hack im sorry xD forgot to put the language, but yeah its visual basic 2008.
    Adam

  9. #9
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Maximising a form?

    if your form have no border, then it will cover the taskbar when maximized

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    131

    Re: Maximising a form?

    no thats not the problem,I already have it full screen. The problem is: "I place things where i want on the design part of the form and it all looks fine. but when the programs ran it goes to full screen so all the things that were on the designer page go to the left hand top corner of the screen. so its not in proportion. I think ive tried the anchor property to no avail."
    Adam

  11. #11
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Maximising a form?

    yah, for that my suggessin is to place all the controls in a frame or image control and maintain its location on form resized event. wait ill pst and example.

  12. #12
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Maximising a form?

    Code:
    Private Sub Form_Resize()
    Me.Frame1.Left = (Me.ScaleWidth / 2) - (Me.Frame1.Width / 2)
    Me.Frame1.Top = (Me.ScaleHeight / 2) - (Me.Frame1.Height / 2)
    End Sub
    The control will remain in the center whenever the form resized.
    Attached Files Attached Files

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    131

    Re: Maximising a form?

    Hey, that worked. Is the equivalent of a frame in VB8 a groupbox? or label?
    the only problem being with this its always in the center what if i wanted to put a bar at the bottom of the page and keep it constantly there. Or to keep a box in a random place in the form when resized? What do i change?
    Adam

  14. #14
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Maximising a form?

    for bar even you just calculate the top and left positions.
    btw, i dont have any idea on vb2008

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    131

    Re: Maximising a form?

    oh it is a groupbox
    and ill give things ago, if i have troubles ill be back. Thanks
    Adam

  16. #16
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    330

    Re: Maximising a form?

    I know what you mean, seriously, but I have no clue.

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    131

    Re: Maximising a form?

    lol maybe you could try and explain it better than i can then xD
    Adam

  18. #18

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    131

    Re: Maximising a form?

    sorry guys just got back from holiday. Right, fazi your code worked well in vb6 but i cant seem to get it to work in 8. Can anyone get this to vb 8 code?

    Code:
    Me.GroupBox1.Left = VB8.TwipsToPixelsX((VB8.PixelsToTwipsX(Me.ClientRectangle.Width) / 2) - (VB8.PixelsToTwipsX(Me.GroupBox1.Width) / 2))
            Me.GroupBox1.Top = VB8.TwipsToPixelsY((VB8.PixelsToTwipsY(Me.ClientRectangle.Height) / 2) - (VB8.PixelsToTwipsY(Me.GroupBox1.Height) / 2))
    Adam

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