Running my windows forms on screens set to 133 DPI has some odd effects
(scroll-bars suddenly appearing because objects overflow their containers).
Setting the AutoScaleMode to dpi doesn't seem to fix the problems either. Is
it possible to evaluate the DPI setting within the code and make the
relevant adjustments to your measurements ? C# if possible please :)

Re: Getting the DPI setting? by Herfried

Herfried
Tue Mar 14 12:33:57 CST 2006

"JezB" <jezbroadsword@blueyonder.co.uk> schrieb:
> Running my windows forms on screens set to 133 DPI has some odd effects
> (scroll-bars suddenly appearing because objects overflow their
> containers). Setting the AutoScaleMode to dpi doesn't seem to fix the
> problems either. Is it possible to evaluate the DPI setting within the
> code and make the relevant adjustments to your measurements ? C# if
> possible please :)

The code below can be used inside a form to determine the current DPI
settings:

\\\
using (Graphics g = this.CreateGraphics())
{
x = g.DpiX;
y = g.DpiY;
}
///

In addition to the code above check out the form's 'AutoScale' property.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Re: Getting the DPI setting? by Vish

Vish
Tue Mar 14 14:24:27 CST 2006

Hi Herfried,

Is there anyway the form can maintain the looks on different DPIs?

Thank You,
Vish

"Herfried K. Wagner [MVP]" wrote:

> "JezB" <jezbroadsword@blueyonder.co.uk> schrieb:
> > Running my windows forms on screens set to 133 DPI has some odd effects
> > (scroll-bars suddenly appearing because objects overflow their
> > containers). Setting the AutoScaleMode to dpi doesn't seem to fix the
> > problems either. Is it possible to evaluate the DPI setting within the
> > code and make the relevant adjustments to your measurements ? C# if
> > possible please :)
>
> The code below can be used inside a form to determine the current DPI
> settings:
>
> \\\
> using (Graphics g = this.CreateGraphics())
> {
> x = g.DpiX;
> y = g.DpiY;
> }
> ///
>
> In addition to the code above check out the form's 'AutoScale' property.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>
>
>