Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 583
  • Last Modified:

Picture Box to be same size on the screen across multiple resolutions

I have a picture box on a 1024 x 768 screen that measures 8.5 x 11 inches.  I would like for it to have the same dimensions on a higher resolution screen. Any suggestions experts?  Tks in advance.
0
GCCal
Asked:
GCCal
1 Solution
 
KimputerCommented:
Please note you cannot fix the "real" size of a picture box on any screen. After all, you don't know if the screen is 21", 23" or even 27", as all these screens probably have 1920 x 1080 resolution. You can imagine, if your code works on a 21" screen, with code for 1920 x 1080 resolution, on the 27" screen it's actually bigger. And VB.net (or any other programming code) actually cannot tell how much inch a screen is.
0
 
GCCalAuthor Commented:
Kimputer.............many thanks for your response.  Makes sense.

I worked around it a bit by using this code when the application starts:

        Dim GetWidth = Screen.PrimaryScreen.WorkingArea.Width
        Dim GetHeight = Screen.PrimaryScreen.WorkingArea.Height
        picCanvas.Width = picCanvas.Width * (GetWidth / 1024)
        picCanvas.Height = picCanvas.Height * (GetHeight / 768)

It is not perfect, but it gets the dimensions close enough for me

Thanks again.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now