when image is added the current image should move to the left and preview the new added + need the slider to go back and forward or click image to view please urgent
The only helpful item for doing most of this that comes with VB6 is the DataRepeater control. However it requires more setup work than 99.999% of VB6 programmers are willing to deal with, and it only scrolls vertically.
You're going to have to roll your own. I'd start by looking at examples that show how to scoll the contents of a PictureBox and go from there.
ok thanks am looking forwad to doing this , as u se it shows add picture and , added pictures are added small icon when clicked preview is shown in big window how to do that
Maybe I have this wrong. Did you want to select picture files and have them go into some kind of horizontally scrollable list? Then you click on one in the list to show it as the larger image?
Sort of like in this crude drawing where the user clicked on the 4th picture?
wow u read my mind that is exactly what i want sir,
can you also add a feature in project along with new picturebox if that picture is loaded then auto load that image into the scrollerbar area
2nd feature.
like add picture1 and command1 when u click command1 it should add and add that picture1 to scroller list , dont worry in my project i have picture1 image change when server sends to client and loads up the image in picture1 , so i hope u get the image in your head what i want.
Well the bad news is... that was just a drawing, not a test program. I was just trying to understand what you need. I don't have any code to do this.
So these pictures come from a network connection (Winsock or another socket library) and not from local disk files?
It sounds like:
You get a picture from the server and put it into a PictureBox.
Then you want to click a Command button to "add" to the list.
After that you want to be able to scroll and click on the scrolling thumbnails to load the picture into a second PictureBox?
I'm not quite sure when the "autoload" should happen.
How many PictureBox controls do you have? Just one (big one) that shows both new pictures from the server and "picked" pictures from the scrolling list? Plus some little preview picture?
Don't you need to also load new pictures from the local hard drive or someplace?
Maybe none of those details matter though. Are you really mostly asking for a scrollable "image picker" with methods to AddNew, ClearAll, and FetchPicked image along with a Click event when clicked?
Where would the full size images be cached? If the list gets long it could be a lot of memory. Maybe just have the thumbnails be in memory with the full size images in a temporary/working disk directory?
Again, just trying to get the concepts clear. Maybe somebody else will make one before I get a chance to. I don't have anything for doing this sort of thing that I can change around.
Lots of little things to do like make the scrolling thing itself as well as dealing with scaling and centering each full image as a thumbnail, etc.
Maybe none of those details matter though. Are you really mostly asking for a scrollable "image picker" with methods to AddNew, ClearAll, and FetchPicked image along with a Click event when clicked?
Private Sub PaintCentered(ByVal Pic As StdPicture)
Dim Factor As Double
Dim ScaledWidth As Single
Dim ScaledHeight As Single
With Picture1
.Cls
Factor = Pic.Width / ScaleX(.ScaleWidth, .ScaleMode, vbHimetric)
If ScaleY(Pic.Height / Factor, vbHimetric, ScaleMode) > .ScaleHeight Then
Factor = Pic.Height / ScaleY(.ScaleHeight, .ScaleMode, vbHimetric)
End If
ScaledWidth = ScaleX(Pic.Width / Factor, vbHimetric, .ScaleMode)
ScaledHeight = ScaleY(Pic.Height / Factor, vbHimetric, .ScaleMode)
.PaintPicture Pic, _
Fix((.ScaleWidth - ScaledWidth) / 2), _
Fix((.ScaleHeight - ScaledHeight) / 2), _
ScaledWidth, _
ScaledHeight
End With
End Sub
add options in this code like
hight = 200
wighth = 200
so i can then play with it till it works for me plz
That's part of the demo project and not the image picker itself.
I'm not sure what you want to do differently in this code though. As it stands it just tries to scale the picture to fit within Picture1, maintaining the original aspect ratio and centered within Picture1.
If you want the Picture1 control to change size you can use its .Move method or adjust its .Left, .Top, .Width, and .Height properties.
If you want to "zoom" in or out you could use a Zoom argument (2.0 = 200%, 1.0 = 100%, 0.5 = 50%, etc.). If you want to force the Width or Height to a given value that should be easy enough too.
Code:
Private Sub PaintCentered( _
ByVal Pic As StdPicture, _
Optional ByVal MaxWidthPx As Single, _
Optional ByVal MaxHeightPx As Single, _
Optional ByVal Zoom As Single = 1#)
Dim MaxW As Single
Dim MaxH As Single
Dim Factor As Double
Dim ScaledWidth As Single
Dim ScaledHeight As Single
With Picture1
.Cls
If MaxWidthPx = 0 Then
MaxW = ScaleX(.ScaleWidth, .ScaleMode, vbHimetric)
Else
MaxW = ScaleX(MaxWidthPx, vbPixels, vbHimetric)
End If
If MaxHeightPx = 0 Then
MaxH = ScaleY(.ScaleHeight, .ScaleMode, vbHimetric)
Else
MaxH = ScaleY(MaxHeightPx, vbPixels, vbHimetric)
End If
Factor = Pic.Width / MaxW
If Pic.Height / Factor > MaxH Then
Factor = Pic.Height / MaxH
End If
Factor = Factor / Zoom
ScaledWidth = ScaleX(Pic.Width / Factor, vbHimetric, .ScaleMode)
ScaledHeight = ScaleY(Pic.Height / Factor, vbHimetric, .ScaleMode)
.PaintPicture Pic, _
Fix((.ScaleWidth - ScaledWidth) / 2), _
Fix((.ScaleHeight - ScaledHeight) / 2), _
ScaledWidth, _
ScaledHeight
End With
End Sub