Solved

Problems with Picture as background in VB6 form

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

746 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

14 Experts available now in Live!

Get 1:1 Help Now