Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6
I have created a program which is more on loading an image. I have already finish my program but I have still a problem in running my program. My program is too slow because of large images.
I try this code to make the images lighter but it doesn't work.
Public Sub LoadImage(ByVal imgName As String)
    With Entry1
        .imgView.ScrollBars = SB_Both
        .imgView.ViewUpdate = True
        .imgView.ToolSet TOOL_Hand, IXMOUSEBUTTON_Left, 0
        .imgView.PageNbr = imgPage
        .imgView.fileName = imgPath & imgName
        .imgView.IResX = 300
        .imgView.IResY = 300
        '.imgView.AutoSize = ISIZE_ResizeImage
        .imgView.SaveFile
        .imgView.ZoomToFit ZOOMFIT_BEST
    End With
End Sub
 

Is there any way to make the images lighter? or to resize an image?
Any help will be accepted.
Posted 4-May-13 9:12am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you use Image control[^], you can use simply trick from: http://visualbasic.freetutes.com/learn-vb6/picturebox-image-controls.html[^]
' Load a bitmap.
Image1.Stretch = False
Image1.Picture = LoadPicture("c:\windows\setup.bmp")
' Reduce it by a factor of two.
Image1.Stretch = True
Image1.Move 0, 0, Image1.Width / 2, Image1.Width / 2
 
Another way to increase performance, is to use AutoRedraw property.
Image1.AutoRedraw = True 'False
 
For PictureBox control, refer this: http://msdn.microsoft.com/en-us/library/zzt5x46b%28v=vs.80%29.aspx[^]
Picture1.AutoSize = True 'False
 
Have a look here:
http://stackoverflow.com/questions/12516376/resizing-a-picture-to-a-fixed-size-in-vb6[^]
http://www.chestysoft.com/ximage/vb/image-resize-vb.asp[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 300
1 ProgramFOX 165
2 Peter Leow 130
3 Zoltán Zörgő 110
4 Maciej Los 80
0 OriginalGriff 300
1 ProgramFOX 165
2 Peter Leow 130
3 Sergey Alexandrovich Kryukov 85
4 Maciej Los 80


Advertise | Privacy | Mobile
Web03 | 2.8.150301.1 | Last Updated 5 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100