Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Different computers, different appearences?! VB6

I was making a hebrew language teacher for my mom in VB6.  An image of what I want the program to look like (and what it looks like on mine) can be found at http://www.qedft.com/cached/teacher2.PNG

However, the appearance of what it looks like on the 3 other computers I tested it on can be found at http://www.qedft.com/cached/teacher2.JPG

As you can see, in the JPG file a lot of the images cut off (the hebrew writing is an image).  Can somebody please tell me why this is happening and how I can fix this (or if you only have the solution it will be enough)

Thanks  (:

--
cachedVB
0
cachedVB
Asked:
cachedVB
  • 9
  • 8
  • 2
  • +2
1 Solution
 
Jaime OlivaresSoftware ArchitectCommented:
I guess this is a form. Form elements depends on font size. So, if different machines have different fonts then form element will be clipped.
It is better to use WinAPI bitmap functions to draw images (with clipping problems)
0
 
gregoryyoungCommented:
they appear to be running at different resolutions i.e. 800x600 vs 1024x768
0
 
gregoryyoungCommented:
my observation is based on the different sizing of the images.
0
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.

 
cachedVBAuthor Commented:
I changed the resolutions but it didnt work.  The parts that get cutoff are not fonts, but are rather images.
0
 
Jaime OlivaresSoftware ArchitectCommented:
>The parts that get cutoff are not fonts, but are rather images
yes I know, but the container element has been downsized in another machine. Could be 2 problems: font-size (the unit of measure) is different, or resolution is different. So, as I told you, it is better to draw bitmaps directly with WinAPI: BitBlt or StretchBlt, could be a bit messy but works fine and faster.

0
 
cachedVBAuthor Commented:
How can I do this? I am not familiar with API at all
0
 
travisjhallCommented:
Doesn't Windows provide Hebrew language support? I know this doesn't really answer your question, but why use images for your Hebrew writing rather than just install and use Hebrew language support and fonts? Or am I misremembering and Windows does not support Hebrew?
0
 
cachedVBAuthor Commented:
It would take too long to install it on 30 computers... any also you can see the other images are cut off too so it doesnt matter because once i can fix one i can fix all i believe
0
 
kouroshparsaCommented:
Instead of using the form background, try an image box or a picture box.
With an image box, you can easily change the size...
It should work just fine.

If did not work, go with BitBlt

As well, I think your picture has a very low resolution.
I suggest you re-create your image with a higher resolution or if you don't know how, then keep in mind,    bigger size=higher resolution
0
 
cachedVBAuthor Commented:
WHY IS NOONE ANSWERING MY QUESTION? I ASKED HOW DO I DO IT AND YOU JUST TELL ME USE BitBLT.
0
 
kouroshparsaCommented:
To resize try this:       (0.5 is any number you want,    0.5=half)
Example:
Picture1.PaintPicture Picture1.Image, 0, 0, 0.5* Picture1.Width, 0.5*Picture1.Height, Picture1.Left, Picture1.Top, Picture1.Width, Picture1.Height
'=============
About BitBlt:
All info at this website:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_0fzo.asp

Sincerely, I once wanted to do complecated things with BitBlt...I think it is messy for your purpose and does not make any difference in your case !

You should understand the fact that if you try to make your picture bigger than its original size, no matter what you do, you never get a good quality !

Anyway, in order to use BitBlt, you need some libs in a module such as:

Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
0
 
cachedVBAuthor Commented:
:( the first thing doesnt work and this still confuses me... can i send you the whole source and you can do it manually? If you fix it you get all the points.
0
 
kouroshparsaCommented:
If you send me the hole thing, I do my best to fix it.
My whole purpose is helping you.
0
 
cachedVBAuthor Commented:
Where do i send it?
0
 
kouroshparsaCommented:
kopack@shaw.ca
0
 
kouroshparsaCommented:
I guess I know what the problem is, but why did you send me an exe file ?
Do you think I can change your exe file??? Nooooooooooooooooo
If you send me your vb code (or better vb project) I'll fix that.
By the way, you should put an exit button on your application !!!

Send me you code or I won't be able to help.
0
 
cachedVBAuthor Commented:
o oops i thought that was the project... my bad 1 sec
0
 
kouroshparsaCommented:
As I open or run your project, I get errors because the pictures are missing.
To improve your program there are many things you should do. You don't need this many forms ? Man, I'm shocked. You should use one form and one timer and one...of everything. All your forms are the same !
I'm sure you are not deep in programming. You should try not to use any any any Global variable. It's dangerous.
Send me your pictures, I redesign the whole thing and send you my sample.
You better load the pictures when the program is running. One advantage of that is that you can always replace or add more picures to extend your program. I'm glad you used an array of pictures. That's right.
By the way did you know that pictureBox has a autosize property that you could set it to true ?!!
Try it.
0
 
kouroshparsaCommented:
I figured THE SOLUTION that work in any condition on any computer to fix the size ("clipping") problem. I send you a sample like the following.
I don't think, there is any way to directly load a picture into a variable or such a thing, so you need a hidden pictureBox (it's size does not matter) in order to load the picture temporarily in there, then you call the method I made to copy and fit it in your pictureBox.
You need: a pictureBox named HiddenPic
                                 and      Pic1
'--------Start of the fit method
Private Sub FitPictureToBox(ByVal pic_src As PictureBox, pic_dst As PictureBox)
Dim aspect_src As Single
Dim wid As Single
Dim hgt As Single

    ' Get the original picture's aspect ratio.
    aspect_src = pic_src.ScaleWidth / pic_src.ScaleHeight

    ' Get the size available.
    wid = pic_dst.ScaleWidth
    hgt = pic_dst.ScaleHeight

    ' Adjust the wid/hgt ratio to match aspect_src.
    If wid / hgt > aspect_src Then
        ' The area is too short and wide.
        ' Make it narrower.
        wid = aspect_src * hgt
    Else
        ' The area is too tall and thin.
        ' Make it shorter.
        hgt = wid / aspect_src
    End If

    ' Center the image at the correct size.
    pic_dst.Cls
    pic_dst.PaintPicture pic_src.Picture, _
        (pic_dst.ScaleWidth - wid) / 2, _
        (pic_dst.ScaleHeight - hgt) / 2, _
        wid, hgt
End Sub
'-----------------------------End
1- Try to remove all the global variables
2- Put the following at the beginning of your code for safety:   Option Explicit
2- Use one single form
3- Use a static variable so every time the user enters the right or wrong answer, it will stay in the memory (The Scope and the LifeTime of variable are 2 different things)

==========You can call the above method like this:

fname = App.Path & "\pic1.jpg"
PicHidden.Picture = LoadPicture(fname)
FitPictureToBox PicHidden, Pic1
0
 
cachedVBAuthor Commented:
the problem is, it will have overlap with that... i am looking for something that can maybe force the image into a particular size
0
 
kouroshparsaCommented:
my code fits your picture in the pictureBox properly.
Do you want to shrink the picture as well ?
I can help you with that, but shirinking, disfigures your pictures
meaning that if one of your pictures has a much longer hight than its width (or the other way) your picture will be streched and will seem fater ot taller !
Anyway, if you want that let me know.

By the way, some programmers talked about using a hebrew font...
I'm sure you can do that. You just need to "install" a Hebrew font (you may download it).
It's not difficult, just copy your font to \WINDOWS\Fonts

If you want to do it on several computers, I still think it is worth it. You can even make your software in a way to automattically do the installation...
0
 
cachedVBAuthor Commented:
thats true, but I'm lazy and that works =D
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.

  • 9
  • 8
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now