Can somebody please tell me how to determine the system's dpi setting (e.g.,
96 dpi for normal size, 120 dpi for large size or some other value for custom
dpi).
Thanks,
Lance 8 9013
This is one way:
<DllImport("user32.dll")> _
Public Shared Function GetDC(ByVal hWnd As HandleRef) As IntPtr
End Function
<DllImport("gdi32.dll")> _
Public Shared Function GetDeviceCaps(ByVal hDC As IntPtr, ByVal nIndex As
Integer) As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr)
As Integer
End Function
dDC = GetDC(Nothing) ' Get desktop DC
dpi = GetDeviceCaps(dDC, 88)
MsgBox("DPI Value: " & dpi.ToString())
rv = ReleaseDC(Nothing, dDC)
Alternatively,
Dim dDC As IntPtr
Dim rv As Integer
Dim g As Graphics
dDC = GetDC(Nothing) 'Get desktop DC
g = Graphics.FromHdc(dDC)
MsgBox("DPI Value: " & g.DpiX.ToString())
g.Dispose()
rv = ReleaseDC(Nothing, dDC)
Yet another way, if you have a Windows form (Form1),
Dim g As Graphics
g = Graphics.FromHwnd (Form1.Handle)
MsgBox("DPI Value: " & g.DpiX.ToString())
g.Dispose()
Hope this helps?
"ljlevend2" <lj*******@nospam.nospam> wrote in message
news:5E**********************************@microsof t.com...
Can somebody please tell me how to determine the system's dpi setting (e.g.,
96 dpi for normal size, 120 dpi for large size or some other value for
custom
dpi).
Thanks,
Lance
This is one way:
<DllImport("user32.dll")> _
Public Shared Function GetDC(ByVal hWnd As HandleRef) As IntPtr
End Function
<DllImport("gdi32.dll")> _
Public Shared Function GetDeviceCaps(ByVal hDC As IntPtr, ByVal nIndex As
Integer) As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr)
As Integer
End Function
dDC = GetDC(Nothing) ' Get desktop DC
dpi = GetDeviceCaps(dDC, 88)
MsgBox("DPI Value: " & dpi.ToString())
rv = ReleaseDC(Nothing, dDC)
Alternatively,
Dim dDC As IntPtr
Dim rv As Integer
Dim g As Graphics
dDC = GetDC(Nothing) 'Get desktop DC
g = Graphics.FromHdc(dDC)
MsgBox("DPI Value: " & g.DpiX.ToString())
g.Dispose()
rv = ReleaseDC(Nothing, dDC)
Yet another way, if you have a Windows form (Form1),
Dim g As Graphics
g = Graphics.FromHwnd (Form1.Handle)
MsgBox("DPI Value: " & g.DpiX.ToString())
g.Dispose()
Hope this helps?
"ljlevend2" <lj*******@nospam.nospam> wrote in message
news:5E**********************************@microsof t.com...
Can somebody please tell me how to determine the system's dpi setting (e.g.,
96 dpi for normal size, 120 dpi for large size or some other value for
custom
dpi).
Thanks,
Lance
Great stuff. Thanks!
Lance
Great stuff. Thanks!
Lance
"ljlevend2" <lj*******@nospam.nospam> schrieb: Can somebody please tell me how to determine the system's dpi setting (e.g., 96 dpi for normal size, 120 dpi for large size or some other value for custom dpi).
Create a 'Graphics' object for a form, for example, and check its 'DpiX' and
'DpiY' properties.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
"ljlevend2" <lj*******@nospam.nospam> schrieb: Can somebody please tell me how to determine the system's dpi setting (e.g., 96 dpi for normal size, 120 dpi for large size or some other value for custom dpi).
Create a 'Graphics' object for a form, for example, and check its 'DpiX' and
'DpiY' properties.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Web Webon |
last post by:
Hi everybody!
I wonder if this is possible?
I need to determine if a client is using "windows classic folders" or
anything else. If I instantiate a Shell ActiveX object is there a way
of...
|
by: Brad |
last post by:
My company is setting up a deployment process for implementing .NET Windows
applications. One of the standards we want the process to enforce is
verifying that the assembly is built in release...
|
by: Danny Miller |
last post by:
Hi there,
I've got a web app that uses impersonation and makes calls to a SQL Server
backend. I'd like to be able to automate the setting of database security for
the web app upon deployment....
|
by: lcifers |
last post by:
Is there a way, through VB.NET, to determine if the user has selected
this option? I am writing an application that does some string
functions to rename files, and the file names get chopped up if...
|
by: ljlevend2 |
last post by:
Can somebody please tell me how to determine the system's dpi setting (e.g.,
96 dpi for normal size, 120 dpi for large size or some other value for custom
dpi).
Thanks,
Lance
|
by: Chuck P |
last post by:
How can you determine if you are in debug mode in Asp.net 2.0
I thought I could look at the web.config compilation debug directive
but then I read this...
|
by: Object01 |
last post by:
We're working with some benchmarks designed to test x86 vs. x64
performance (both on a x64 system). To ensure that our assemblies are
loaded as x86 or x64, we specifically target our builds to the...
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
I have code to bold text in a datagridviewcell:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim cs As DataGridViewCellStyle, fnt...
|
by: MLH |
last post by:
Access 97 does not provide a means of reading the
most recent setting for SetWarnings Method. For
example, if you had CBF that called a procedure in
a global module and the following statement was...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |