0

I want to get width of windows form.

int x=this.Width;

But when form is maximised (on full screen) , if im on fullHD resolution(1920*1080) its returning 1536.
When i set resolution to 1600*900, its returning 1600 properly.
Also , since Im using new laptop, forms are little blury , i dont know why, but i have read that there is some kind of problem with high DPI screens, i didnt find solution so far.

This is my form designer generated code

this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(1902, 1033);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Form1";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Click += new System.EventHandler(this.Form1_Click);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.ResumeLayout(false);
Mugiwara
  • 866
  • 1
  • 11
  • 33
Flo Rida
  • 55
  • 6
  • 1
    The blurry font issue is because of the DPI. Take a look at [this post](https://stackoverflow.com/a/33588482/3110834). – Reza Aghaei Jun 10 '18 at 19:32
  • Besides the link Reza posted, read the *Remarks* section of the [`PROCESS_DPI_AWARENESS`](https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx) enumeration (parameter of `SetProcessDpiAwareness()`). It explains the different behaviours in relation to the DPI *awareness* of you application. Take a look at [SetProcessDpiAwarenessContext](https://msdn.microsoft.com/en-us/library/windows/desktop/mt807676%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396) too. – Jimi Jun 10 '18 at 22:46

0 Answers0