Solved

Problems with Picture as background in VB6 form

Posted on 2003-10-31
5
1,204 Views
Last Modified: 2013-12-03
Hi,
   I am trying to use a picture created using MS Paint (BMP) as background for the form. I noticed difference, when I run the same app on laptop and PC. If I size the form for the size of bitmap picture on laptop, it looks perfect on the laptop, but when I run the same app on a desktop, the picture looks streteched and as wll as clipped, so total picture is not shown as it is bigger than form size. I tried all the resolutions on the Desktop, the effect is same.
   The otherway also it is same. If I design / compile the form on the PC to the size of bitmap it looks perfect on Desktop, but when I run on laptop, it looks shrunk and picture background is smaller than the form size.
   what am I missing here? What things I need to consider when using bitmap / jpeg / gif picture as background in the forms, and need to run the application on laptops as well as desktops.
Help is appreciated.

Thanks,
Kumar
0
Comment
Question by:ktalinki
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:Dang123
ID: 9660248
Are you running the same OS on both the desktop and laptop?

0
 
LVL 9

Expert Comment

by:Dang123
ID: 9660275
Do you have the same color depth set on both?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9660375
Do you have the same screen resolution? (800x600, 1024x728 and so on)
0
 
LVL 15

Accepted Solution

by:
ameba earned 500 total points
ID: 9662440
You are using Large Fonts setting in Display Properties of your PC.

1) Use Small Fonts on all computers
2) Prepare 2 bitmaps, and load the right one, depending on user's font setting
3) If bitmap looks OK when scaled, draw the background picture so it covers the whole form:

Private Sub Form_Load()
    Dim px As Single
    On Error Resume Next
   
    px = Screen.TwipsPerPixelX
    If px = 15 Then
        ' user is using normal fonts
        Set Me.Picture = LoadResPicture(4, vbResBitmap)
    Else
        ' user is using large fonts
        AutoRedraw = True
        Call PaintPicture(LoadResPicture(4, vbResBitmap), 0, 0, ScaleWidth, ScaleHeight)
    End If
End Sub


Note:
If Screen.TwipsPerPixelX is 15 - user is using normal fonts
If it's 12 - user is using Large fonts
Other values - user is using scaled font size.

If you use gif or other compressed picture format, loading might be slow.  I suggest bmp, stored in res file or in app directory.
0
 
LVL 15

Expert Comment

by:ameba
ID: 9692567
Thanks!
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 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