fair enough, but make sure that the user understands the option is  a global
setting and not application specific, unless you are planning to apply and
reset the option on the startup and exit of your application

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 08 September 2003 03:56
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Changing Screen DPI


And If you just want to enable this feature at your solution for letting a
user decide
For him self what his preferred dpi settings ?

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Stevens
Sent: Thursday, September 04, 2003 1:57 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Changing Screen DPI

Thats Cool!, the question however is why would you want to do that and how
many users would be sending you hate-mail for having done it?

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 04 September 2003 12:05
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Changing Screen DPI


Problem solved !

I've found the way to change it !

First we might want to know what is the current dpi settings (are we using
small (96dpi) font or big fonts (120dpi)) LOGPIXELSY is the number of pixels
contained in a logical inch on the device (dpi). This value is obtained by
calling the GetDeviceCaps() function with the LOGPIXELSY index (const of
integer - 90).
int GetDeviceCaps( HDC hdc,     // handle to DC
                   int nIndex   // index of capability );

ok so we got the DPI... how do we set it to something else... here comes an
undocumented api by the name of SetupChangeFontSize which reside in
SysSetup.dll which let you change the font size from 96dpi to 120dpi
(changing small fonts to large fonts and vice versa)

DWORD WINAPI SetupChangeFontSize( HANDLE HWindow, LPCWSTR lpszFontSize)
SetupChangeFontSize Gets two parameters:
Handle of the calling window (i used NULL) font size string in unicode
format:
"120" for Large fonts and "96"  for Small fonts the return value in a win32
Error code for example:
ERROR_SUCCESS   ( Value == 0    )  The operation completed successfully.
ERROR_CANCELLED ( Value == 1223 )  The operation was canceled by the user.

So the pattern of converting to 120dpi will be try to change the font size
using the SetupChangeFontSize api, checking the return code and if its 0
(success) just do reboot of the system.

[DllImport("gdi32")]
static extern long GetDeviceCaps(IntPtr hdc,long nIndex);

[DllImport("user32.dll",EntryPoint="GetDC")]
public static extern IntPtr GetDC(IntPtr ptr);

[DllImport("SysSetup.dll",EntryPoint="SetupChangeFontSize",CharSet=CharSet.U
nicode)]
public static extern long SetupChangeFontSize(IntPtr HWindow,string
lpszFontSize);

--- check dpi settings ---
IntPtr hDC = GetDC(GetDesktopWindow());
int LOGPIXELSY = 90;
long currentDPI = GetDeviceCaps(hDC, LOGPIXELSY); label1.Text="Current
Screen DPI Setting is : "+currentDPI.ToString()+"dpi
"+((currentDPI==96)?"Small Fonts":"Big Fonts");

--- change dpi settings ---
SetupChangeFontSize(IntPtr.Zero,"120");
MessageBox.Show("Font Size Changed to 120dpi Large Fonts\n System needs to
reboot");

Or

SetupChangeFontSize(IntPtr.Zero,"96");
MessageBox.Show("Font Size Changed to 96dpi Small Fonts\n System needs to
reboot");

Ohad Israeli
Team Leader
Magen - Microsoft Technology Center


-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of J. Merrill
Sent: Wednesday, September 03, 2003 10:13 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Changing Screen DPI

You can't change the Display (or Printer) DPI setting to a particular value,
though you can make changes to the resolution that affect DPI.  All you can
[at best] do is change the number of dots (pixels) displayed on the full
screen (or, for a printer, on a page).

You can't write software that changes the physical size of the screen; since
DPI is "dots per inch", all you can change is "dots" which will be divided
by the screen width (or height) (in inches) resulting in some particular DPI
value.

At 05:36 PM 9/3/2003 +0300, =?windows-1255?B?4OXk4yDp+fjg7Ok=?= wrote
>
>Hi,
>
>I am looking for an api to change the Display DPI setting (Display
>properties -> Settings - > Advance) I know how to change the screen
>resolution color death etc... Using ChangeDisplaySettings api of user32
>but
I could not find anywhere how to change the dpi settings through programming
lang.
>
>Is there anyone out there who knows the answer ?
>
>Ohad.


J. Merrill / Analytical Software Corp

===================================
This list is hosted by DevelopMentor®  http://www.develop.com NEW! ASP.NET
courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com NEW! ASP.NET
courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

****************************************************************************
**********************************************
Everything in this e-mail and attachments relating to the official business
of MultiChoice Africa is proprietary to the company. Any view or opinion
expressed in this message may be the view of the individual and should not
automatically be ascribed to the company.  If you are not the intended
recipient, you may not peruse, use, disseminate, distribute or copy this
message. If you have received this message in error, please notify the
sender immediately by email, facsimile or telephone and destroy the original
message.
****************************************************************************
**********************************************

===================================
This list is hosted by DevelopMentor®  http://www.develop.com NEW! ASP.NET
courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

**************************************************************************************************************************
Everything in this e-mail and attachments relating to the official business of 
MultiChoice Africa is proprietary to
the company. Any view or opinion expressed in this message may be the view of the 
individual and should not automatically
be ascribed to the company.  If you are not the intended recipient, you may not 
peruse, use, disseminate, distribute or
copy this message. If you have received this message in error, please notify the 
sender immediately by email, facsimile
or telephone and destroy the original message.
**************************************************************************************************************************

===================================
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com
  • [A... אוהד ישראלי
    • ... Jekke Bladt
      • ... Peter Vervoorn
    • ... J. Merrill
    • ... אוהד ישראלי
    • ... Paul Stevens
    • ... אוהד ישראלי
    • ... Paul Stevens
    • ... J. Merrill

Reply via email to