Solved

Programming VB to Handle DISPLAY SETTINGS + GENERAL + DPI SETTING + LARGE SIZE (120 DPI)

Posted on 2004-04-16
7
347 Views
Last Modified: 2011-09-20
Ladies and Gentlemen,

I have a VB application which is working pretty well (with your valuable help).  I installed a copy last week on a computer which was connected to a large (19") high resolution (1600 x 1200) LCD monitor.  My user has set the display properties to use "LARGE SIZE (120 DPI)" on the General tab.

My dialog box contains a tab control which adjusts the size (width) of the dialog box according to which tab is being used.  Unfortunately the "LARGE SIZE (120 DPI)" setting is fouling things up.  Is there an easy way in VB to query windows about the DPI of the display so that an IF statement can appropriately adjust widths.

Is there another way that control sizes should be designed for to allow users to make this DPI adjustment?

Thanks,

Matt
0
Comment
Question by:mebmmb
  • 2
  • 2
7 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 10846052
Hi mebmmb:
Just a pointer in the right direction
Try experimenting with the Screen object
Depending on your screen, Screen.Height and Screen.Width change
The screen object has other properties which might be usefule

Dabas
0
 

Author Comment

by:mebmmb
ID: 10846149
I've looked under SCREEN and SCREEN OBJECT and seen a couple of references which might end up being helpful.  Is there  way to tie a property like SSTAB1.WIDTH to TWIP or object.TwipsPerPixelX?  I assume that SSTAB1.WIDTH is in pixels.

Thanks,

Matt
0
 
LVL 27

Accepted Solution

by:
Dabas earned 125 total points
ID: 10846234
mebmmb:
>  I assume that SSTAB1.WIDTH is in pixels
Possibly.
What you can do is check your current settings - something you physically know - and store the Height and Width as constants
Then, when you load the form, you can compare the screen settings with these constants, then adjust the SSTAB1.Width by the ratio
Something like
Const MyScreenWidth = 15360
...
Sub Form_Load
UserScreenWidth = Screen.Width
Ratio = UserScreenWidth/MyScreenWidth
SSTAB1.Width = SSTAB1.Width * Ratio

(Not tested... just a pointer to the idea. you might have to divide by ratio...)

Dabas
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10848553
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 125 total points
ID: 10848557
The Screen object's Width and Height properties give the screen size in twips. Its TwipsPerPixelX and TwipsPerPixelY properties give the number of twips per pixel in the horizontal and vertical directions. Divide twips by twips-per-pixel to get pixels.  
 
 
Private Sub Form_Load()
Dim wid As Integer
Dim hgt As Integer

    wid = Screen.Width \ Screen.TwipsPerPixelX
    hgt = Screen.Height \ Screen.TwipsPerPixelY

    Label1.Caption = Format$(wid) & " x " & Format$(hgt)
End Sub
 
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 79
How can i compile this github project?? 2 75
Beginner to Unreal Engine 4 5 61
Auto-indent certain lines in Notepad++ 10 29
A short article about problems I had with the new location API and permissions in Marshmallow
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now