Click here to Skip to main content
15,915,600 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Xml Serializer - Default namespace on top-level Element Pin
Mark Salsbery22-Jul-09 6:08
Mark Salsbery22-Jul-09 6:08 
GeneralRe: Xml Serializer - Default namespace on top-level Element Pin
Martijn Boeker22-Jul-09 8:17
Martijn Boeker22-Jul-09 8:17 
QuestionProblem in break point Pin
rinku soni 2321-Jul-09 1:28
rinku soni 2321-Jul-09 1:28 
AnswerRe: Problem in break point Pin
Baran M22-Jul-09 22:56
Baran M22-Jul-09 22:56 
Questionhow to change DataGridViewLinkColumn text property forselected row only ?? Pin
TARAK NATH ROY20-Jul-09 23:12
TARAK NATH ROY20-Jul-09 23:12 
AnswerRe: how to change DataGridViewLinkColumn text property forselected row only ?? Pin
Jack Vanderhorst23-Jul-09 16:15
Jack Vanderhorst23-Jul-09 16:15 
QuestionCrystal report print error when canceled by user Pin
Rakesh.tecnics20-Jul-09 11:18
Rakesh.tecnics20-Jul-09 11:18 
QuestionHow to get DPI Scaling number within .NET Framework [modified] Pin
fjparisIII20-Jul-09 6:17
fjparisIII20-Jul-09 6:17 
Most people use 96 DPI, but occasionally people set this to 120 DPI (or even higher), especially with high resolution monitors that display at greater than 100 DPI. This number is easy to get under Win32 ("LogPixels") and I've done it for years. But I'm relatively new to .NET and haven't been able to find out what .NET API delivers this number. This is such an important parameter that there must be a simple API to get it under .NET. Does anyone know what it is? This is especially important from Vista onward which doesn't believe in physical pixels, but merely device independent units.

Matthew MacDonald's Pro WPF in C# 2008, chapter 1, has a good discussion of device independent DPI scaling but nowhere does he say how to obtain this crucial number. I need the number because I have to scale the numbers that come back from the monitor enumeration, which specifies, x,y, height, and width, to fill the screen with a bitmap. All these numbers have to be scaled back by a factor 96/x, where x is the DPI Scaling number.

If worse comes to worse, I'll use Interop services to get the number, but I cringe every time I do that, thinking that I've just missed something in .NET.

Addendum: I can also get this number from the Registry: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI]"LogPixels" but that's even more of a hack than Interop Services. The cleanest way would be through a .NET API.

modified on Monday, July 20, 2009 12:36 PM

AnswerRe: How to get DPI Scaling number within .NET Framework Pin
Jimmanuel20-Jul-09 6:38
Jimmanuel20-Jul-09 6:38 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
fjparisIII20-Jul-09 7:40
fjparisIII20-Jul-09 7:40 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 8:33
sitebuilderLuc Pattyn20-Jul-09 8:33 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
fjparisIII20-Jul-09 12:05
fjparisIII20-Jul-09 12:05 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 12:13
sitebuilderLuc Pattyn20-Jul-09 12:13 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
fjparisIII20-Jul-09 13:20
fjparisIII20-Jul-09 13:20 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 13:51
sitebuilderLuc Pattyn20-Jul-09 13:51 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
fjparisIII20-Jul-09 14:03
fjparisIII20-Jul-09 14:03 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 14:09
sitebuilderLuc Pattyn20-Jul-09 14:09 
GeneralRe: How to get DPI Scaling number within .NET Framework [modified] Pin
fjparisIII20-Jul-09 14:36
fjparisIII20-Jul-09 14:36 
AnswerRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 7:04
sitebuilderLuc Pattyn20-Jul-09 7:04 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
fjparisIII20-Jul-09 8:40
fjparisIII20-Jul-09 8:40 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 8:48
sitebuilderLuc Pattyn20-Jul-09 8:48 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
fjparisIII20-Jul-09 12:13
fjparisIII20-Jul-09 12:13 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 12:32
sitebuilderLuc Pattyn20-Jul-09 12:32 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
fjparisIII20-Jul-09 13:31
fjparisIII20-Jul-09 13:31 
GeneralRe: How to get DPI Scaling number within .NET Framework Pin
Luc Pattyn20-Jul-09 14:00
sitebuilderLuc Pattyn20-Jul-09 14:00 

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.