Solved

Problems with Picture as background in VB6 form

Posted on 2003-10-31
5
1,197 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
  • 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

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 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

18 Experts available now in Live!

Get 1:1 Help Now