none
Re-centering items when maximizing RRS feed

  • Question

  • Hello,

    Current my windows app form is setup according to the size i setup in the design tab. However, when i press the maximize button i get a lot of gray space. How would i set up my app so that it re-centers itself when maximized or if the user snaps the windows to half a screen.

    Thanks 

    Monday, January 29, 2018 4:18 PM

Answers

  • Thanks for showing me that thread. I tried their solution but some labels did not center itself as the font increased. Is there a solution to this?

    Hi

    If you followed that thread all the way through, and built the code with all the changes, then everything would have scaled/positioned correctly.

    Without knowing how you have designed your form, perhaps with controls within controls (eg Labels inside Panels etc), there is no way to advise any further.


    Regards Les, Livingston, Scotland

    • Marked as answer by opewkd Monday, January 29, 2018 8:48 PM
    Monday, January 29, 2018 5:43 PM

All replies

  • Hi

    One way which I have used in a couple of projects with great success can be found in THIS thread (solution by IronRazerz)


    Regards Les, Livingston, Scotland


    • Edited by leshay Monday, January 29, 2018 4:36 PM
    Monday, January 29, 2018 4:36 PM
  • You are talking about a "windows app", so I may assume XAML (WPF). 

    Use the stretch properties to make it as elastic. 


    Success Cor


    Monday, January 29, 2018 4:40 PM
  • Thanks for showing me that thread. I tried their solution but some labels did not center itself as the font increased. Is there a solution to this?
    Monday, January 29, 2018 5:15 PM
  • It is a Windows Forms App (.Net Framework) in Visual Basics. I am not familiar with elastic and stretch properties is this possible using the .Net Framework in VB.

    Thanks

    Monday, January 29, 2018 5:18 PM
  • Thanks for showing me that thread. I tried their solution but some labels did not center itself as the font increased. Is there a solution to this?

    Hi

    If you followed that thread all the way through, and built the code with all the changes, then everything would have scaled/positioned correctly.

    Without knowing how you have designed your form, perhaps with controls within controls (eg Labels inside Panels etc), there is no way to advise any further.


    Regards Les, Livingston, Scotland

    • Marked as answer by opewkd Monday, January 29, 2018 8:48 PM
    Monday, January 29, 2018 5:43 PM
  • Then follow the thread Les gave. 

    I've seen as Tommy is involved and then it is very extended 

    The stretch property in WPF is almost the same as the anchor in Windows Forms sometimes in combination with the Dock. 

    That is mostly as far as I go with replying on this question, because it is simple clicking in the designer of forms. 


    Success Cor

    Monday, January 29, 2018 5:55 PM
  • Look at

    TableLayoutPanel and FlowLayoutPanel. Both links have walk-troughs.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, January 29, 2018 8:21 PM
    Moderator
  • Thanks, I also found this thread helpful for centering labels:

    https://stackoverflow.com/questions/27611858/center-a-label-on-any-form-vb-net


    Monday, January 29, 2018 8:50 PM