|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What to do when GetDeviceCaps doesn't?chosen Font Size (yes; I'm having to cross sword with "Large Fonts" some ... person .. decided to recommend it to our users). Private Declare Function apiGetDeviceCaps Lib "gdi32.dll" _ Alias "GetDeviceCaps" ( _ ByVal hdc As IntPtr _ , ByVal iIndex As Integer _ ) As Integer Private Const LOGPIXELSX As Integer = 88 Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnLoad(e) Dim g As Graphics = Me.CreateGraphics() Dim ip As IntPtr = g.GetHdc() Dim i As Integer = apiGetDeviceCaps(ip, LOGPIXELSX) g.ReleaseHdc(ip) g.Dispose() MsgBox(i) End Sub Lovely - except that it always seems to return 96, no matter what Font Size I've selected in Control Panel. Any suggestions? TIA, Phill W. Phill W. wrote:
Show quoteHide quote > From what I've been reading, the code below /should/ pop up the Users Phill, this isn't returning the font size from the control panel.> chosen Font Size (yes; I'm having to cross sword with "Large Fonts" some > .. person .. decided to recommend it to our users). > > Private Declare Function apiGetDeviceCaps Lib "gdi32.dll" _ > Alias "GetDeviceCaps" ( _ > ByVal hdc As IntPtr _ > , ByVal iIndex As Integer _ > ) As Integer > Private Const LOGPIXELSX As Integer = 88 > > Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) > MyBase.OnLoad(e) > > Dim g As Graphics = Me.CreateGraphics() > Dim ip As IntPtr = g.GetHdc() > Dim i As Integer = apiGetDeviceCaps(ip, LOGPIXELSX) > g.ReleaseHdc(ip) > g.Dispose() > > MsgBox(i) > > End Sub > > Lovely - except that it always seems to return 96, no matter what Font > Size I've selected in Control Panel. > > Any suggestions? > > TIA, > Phill W. Returns the logical pixels per inch of the screen width. This is changed by hitting the advanced button on your display settings tab, it's the DPI. By default this is 96. The font size is on the appearences tab. I think you might be looking for System.Drawing.SystemFonts. -- Tom Shelton [MVP] Tom Shelton wrote:
> this isn't returning the font size from the control panel. Oops. My mistake.> Returns the logical pixels per inch of the screen width. > This is changed by hitting the advanced button on your display And it's the Font Size that my users have been "recommended" to change > settings tab, it's the DPI. By default this is 96. The font size > is on the appearences tab. and that I now need to work with. I /think/ I saw that value being changed (in RegMon) but it's only stored as the "listindex" of the list used to /select/ each size. Do you know of any reference that defines how this setting affects the font size used? I /assume/ that each one applies a "scaling" of some measure to the default font size; if I knew what each scaling value was, I could probably do what I need with that. > I think you might be looking for System.Drawing.SystemFonts. I'm still using VS'2003 - I don't have a SystemFonts class (yet).Regards, Phill W.
DateTime conversion to Integer
Detecting if a printer is connected to the PC Component UI CAB Architecture Guide??? For Dummies Book? :-) SqlDataAdapter.FillSchema Send SMS from PC through fixed land line Datagrid relationships Math question: Based on excel Regex Question Document VB6: send active hyperlink in body of email sent in VB6 |
|||||||||||||||||||||||