Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
AnswerRe: using dll created by MinGW in C# code Pin
Judah Gabriel Himango13-Nov-07 13:01
sponsorJudah Gabriel Himango13-Nov-07 13:01 
QuestionTo show user's screen resolution ? Pin
omegazafer13-Nov-07 12:42
omegazafer13-Nov-07 12:42 
AnswerRe: To show user's screen resolution ? Pin
Christian Graus13-Nov-07 12:45
protectorChristian Graus13-Nov-07 12:45 
GeneralRe: To show user's screen resolution ? Pin
omegazafer13-Nov-07 12:54
omegazafer13-Nov-07 12:54 
GeneralRe: To show user's screen resolution ? Pin
Christian Graus13-Nov-07 12:58
protectorChristian Graus13-Nov-07 12:58 
GeneralRe: To show user's screen resolution ? Pin
Luc Pattyn13-Nov-07 12:58
sitebuilderLuc Pattyn13-Nov-07 12:58 
GeneralRe: To show user's screen resolution ? Pin
omegazafer13-Nov-07 13:12
omegazafer13-Nov-07 13:12 
AnswerRe: To show user's screen resolution ? Pin
Luc Pattyn13-Nov-07 12:55
sitebuilderLuc Pattyn13-Nov-07 12:55 
Hi,

The Graphics class has DpiX and DpiY properties, so you could capture them in an OnPaint
method.

Also the Graphics that gets created from a neutral image seems to take the current
screen's resolution, so you can do:

Bitmap bitmap=new Bitmap(100, 100);
Graphics gBM=Graphics.FromImage(bitmap);
Console.WriteLine("DpiX="+gBM.DpiX);
gBM.Dispose();


Remarks:
- on XP that setting is hidden somewhere in the Display Properties window
- by default a monitor seems to be set at 96 dpi, which does not necessaraly reflect
the real hardware's characteristics
- when you calculate it yourself, you typically get a higher number (say 120 to 148).
- if you change the Display Properties settings, you will get a bigger desktop, with
everything a lot smaller...
- I have never seen a situation where DpiX!=DpiY (which matches the fact that you can
only set one resolution, good for square pixels only)

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google


GeneralRe: To show user's screen resolution ? Pin
omegazafer13-Nov-07 23:59
omegazafer13-Nov-07 23:59 
Questioncreating Processes to run BAT files using XCOPY Pin
ckelker13-Nov-07 12:30
ckelker13-Nov-07 12:30 
AnswerRe: creating Processes to run BAT files using XCOPY Pin
Dave Kreskowiak14-Nov-07 6:46
mveDave Kreskowiak14-Nov-07 6:46 
GeneralRe: creating Processes to run BAT files using XCOPY Pin
ckelker14-Nov-07 6:58
ckelker14-Nov-07 6:58 
GeneralRe: creating Processes to run BAT files using XCOPY Pin
Dave Kreskowiak14-Nov-07 12:50
mveDave Kreskowiak14-Nov-07 12:50 
GeneralRe: creating Processes to run BAT files using XCOPY Pin
ckelker15-Nov-07 7:31
ckelker15-Nov-07 7:31 
GeneralRe: creating Processes to run BAT files using XCOPY Pin
Dave Kreskowiak15-Nov-07 12:09
mveDave Kreskowiak15-Nov-07 12:09 
QuestionCreateGraphics on a System.Image Pin
codemunkeh13-Nov-07 12:27
codemunkeh13-Nov-07 12:27 
AnswerRe: CreateGraphics on a System.Image Pin
Christian Graus13-Nov-07 12:38
protectorChristian Graus13-Nov-07 12:38 
GeneralRe: CreateGraphics on a System.Image Pin
codemunkeh13-Nov-07 12:50
codemunkeh13-Nov-07 12:50 
GeneralRe: CreateGraphics on a System.Image Pin
Christian Graus13-Nov-07 12:59
protectorChristian Graus13-Nov-07 12:59 
GeneralRe: CreateGraphics on a System.Image Pin
codemunkeh13-Nov-07 13:05
codemunkeh13-Nov-07 13:05 
AnswerRe: CreateGraphics on a System.Image Pin
Luc Pattyn13-Nov-07 13:06
sitebuilderLuc Pattyn13-Nov-07 13:06 
GeneralRe: CreateGraphics on a System.Image Pin
codemunkeh13-Nov-07 13:09
codemunkeh13-Nov-07 13:09 
GeneralRe: CreateGraphics on a System.Image Pin
Luc Pattyn13-Nov-07 13:16
sitebuilderLuc Pattyn13-Nov-07 13:16 
GeneralRe: CreateGraphics on a System.Image Pin
codemunkeh13-Nov-07 13:35
codemunkeh13-Nov-07 13:35 
GeneralRe: CreateGraphics on a System.Image Pin
Luc Pattyn13-Nov-07 13:45
sitebuilderLuc Pattyn13-Nov-07 13:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.