Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problems with Picture as background in VB6 form

Posted on 2003-10-31
5
Medium Priority
?
1,208 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

670 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