Thanks for the info. I was aware why it was doing it, but there are things
other weird and wonderful things. Now it's fine to add this kind of thing on
automatically. This is the key reason why Large Fonts is not used by most
"John Hornick [MSFT]" <JHornick@online.microsoft.com> wrote in message
news:zSIYiQMoDHA.724@cpmsftngxa06.phx.gbl...
> Hi,
>
> You can get "the DPI" by using GetDeviceCaps() API. However, there are
> potentially two DPIs to get - the one returned when you pass LOGPIXELSX/Y,
> and the one you'd get if you do the math using HORZRES/SIZE and
> VERTRES/SIZE.
> See the following article for more info:
>
http://support.microsoft.com/?id=127152 >
> There's probably some way to tell the form to scale the image rather
> than tile it - maybe someone else here knows, or you could post in the
> WindowsForms newsgroup. Otherwise, you could simply handle painting
> yourself, and stretch the image to fill the ClientRectangle.
>
> The reason your "24pixel graphic" is no longer 24 pixels is because it
> never was a 24pixel graphic - it had a real size which happened to map
> to 24 pixels a that DPI. Now it maps to a new pixels size in the new DPI.
>
> Similarly, graphics "draw smaller" because they have a real size and
> GDI+ is drawing them at the real size, based on the current DPI.
>
> The following article talks about GDI+'s device independence which is
> what you're seeing here:
>
http://support.microsoft.com/?id=311460 >
> Thanks,
> - John
> Microsoft Developer Support
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Visit
http://www.microsoft.com/security for current information on
security.
>
>
>
>
> > There are a couple of things in the framework that don't handle nicely
> with
> > DPI changes (well lots of things but two that I have noticed)
> >
> > #1 Background graphics on forms tile in large fonts instead of drawing
> the
> > graphic larger.
> > #2 All of the sizing functions are off when looking at graphics. I.e.
a
> 24
> > pixel graphic is no longer 24 pixels in relation to the newly sized
window
> > for large fonts. Hence if you size yoru control based on the size of a
> > graphic, the control is VERY small and looks out of place.
> > #3 Graphics all draw smaller instead of resizing along with everything
> else
> > the way they should.
> >
> > Ok, so that's not such a big deal if we can work around these by getting
> the
> > DPI that windows is running in (the screen is running in) but the only
> > function I can find on this is the DPI of the graphics object, which of
> > course doesn't cut it. Any ideas on how to get the DPI of windows
through
> > the .net framework so that I can do some math?
>