1

Running into a strange issue. I don't recall this with VB6, but there is apparently a scaling setting (none, Font, Dpi and Inherit) that sees to be controlling how I move controls at runtime versus where they are at design time.

For example.

I have a form with a button. The button's location at design time is 451, 12 but when I try to move it using code at run time, it is not in the top corner where I put it in design time.

The code I used is this to test my theory. I gave it a new location point the SAME as it is in design but it is not showing. Any idea what I am missing here?

Thanks in advance.

Simple Form with a single button.

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Button1.Location = New Point(451, 12)
    End Sub
End Class
FNDevCJ
  • 137
  • 4
  • 18
  • 1
    The AutoScaleMode property is meant to, drumroll, automatically scale the window. Important, lots of video adapters today do not run at 96 dots-per-inch (aka "100%") anymore. That also means you should *never* write code like that. It is okay in the constructor (Sub New), not in the Load event since the window is auto-scaled by then. – Hans Passant Jan 12 '16 at 13:44
  • Good to know. Then is there a link or article that states what the best practice is? – FNDevCJ Jan 12 '16 at 13:46

0 Answers0