Controls location RRS feed

  • Question

  • Controls in editing time are in a position but at running time they are NOT in the same exact position. This is very annoying because sometimes they are one partially over another.
    Monday, March 12, 2018 1:22 PM

All replies

  • Hello,

    Without knowing specifics try working with anchor property and dock property of each control. Also look at TableLayoutPanel.  Working with these properties and TableLayoutPanel may resolve your issue, if not let us know.

    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, March 12, 2018 1:58 PM
  • I believe it is possible your app is not dpi aware but that may be wrong. Visual Studio is dpi aware and therefore in design mode your app appears fine probably but not when run. Try setting your monitors settings in control panel to 100 percent for resolution or whatever setting in percentage may be over 100 percent and see if that corrects any issues.

    La vida loca

    Monday, March 12, 2018 2:04 PM
  • Ernesto,

    Controls will never show up in the same exact position. The designers are just templates. In windows forms it looks often of it is actual, but for instance in WPF it is just a tool to get them is a reasonable dimension of each other. 

    Moreover, for instance labels can have any format at run time depending by the characters which are used. 

    Also be aware that anchors can have the result that they are sometimes partially one over another if they are only anchored to the side of the form and not to the control beside it. 


    Tuesday, March 13, 2018 1:07 AM
  • Hi,

    I agree with Mr. Monkeyboy, since I suppose you are using different DPI between editing time and run time.

    For make your program DPI Aware, please try to the following steps:
    (1) make [AutoScaleMode] Dpi in your Form
    (2) add "app.manifest" in your project
        menu [Project] > [Add New Item] > select [Application Manifest File]
    (3) and change it like this:
    <!-- remove comment for DPI-Aware -->
    <application xmlns="urn:schemas-microsoft-com:asm.v3">
    		<dpiAware xmlns="">true</dpiAware>


    Ashidacchi >>

    Thursday, March 15, 2018 2:00 AM