Results 1 to 2 of 2

Thread: Controls change size and position when displayed in a different tab

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2012
    Posts
    27

    Controls change size and position when displayed in a different tab

    Hi,

    I have several controls on a form which is fixed in size. I have several tabs on the same form and I need to display the same controls on different tabs depending on user selection. To achieve this, I use controls.add() to add each control to the respective tab and then I set the controls size using System.Drawing.Size and the location using System.Drawing.Point. This works fine on the computer that I compile and run the app on however when I run the same app on a different computer, the group box that the controls are inside is larger and the position of the group box is not where it should be. I presume this is happening because the size and x,y coordinates I am specifying are specific and not relative and are being interpreted differently for each platform? Is there a better way to position the controls so that the position is consistent across all platforms?

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,711

    Re: Controls change size and position when displayed in a different tab

    With windows form applications, if the DPI(Dots Per Inch) on the computers vary(which most likely they will) then the position/size of your controls will vary from monitor to monitor.

    WPF uses device independent pixels which will determine the location/size that controls will appear on the different monitors.

    My advice is if you want the location and size to be the same for each computer monitor, use WPF.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

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