Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var graphics = Graphics.FromHwnd(IntPtr.Zero); // This gets the graphics configuration of the current screen
var scaleX = graphics.DpiX / 96; // 96 was our standard design DPI, remember?
var scaleY = graphics.DpiY / 96;
this.button1.Location = new System.Drawing.Point((int)Math.Round(20 * scaleX), (int)Math.Round(20 * scaleY));
this.button2.Location = new System.Drawing.Point((int)Math.Round(30 * scaleX), (int)Math.Round(30 * scaleY));
//Use this with C# and change x,y values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment