need help with PICTURE

Reply

Join Date: Mar 2006
Posts: 3
Reputation: carryyb is an unknown quantity at this point 
Solved Threads: 0
carryyb carryyb is offline Offline
Newbie Poster

need help with PICTURE

 
0
  #1
Mar 30th, 2006
Hello

Can I get 20 pictures opened from visual basics, for example I have a list box with the name of the pictures, unfortunately I cannot open none of them, can someone please send me some code, all I want to do is have a right and left arrow, and each time a user pressed right it will display the next picture, can anyone please help.

thanks for looking

as i said i will have a list box, all i want to do is one the user click on the left and right arrow, it should disply the next picture, is there a way of me doing that, if so can you please show me the code, thanks again
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 186
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: need help with PICTURE

 
0
  #2
Mar 30th, 2006
What is the type of the picture ? If it is something common like bmp, jpg etc, use a image or picture box control to display it.

Image1.Picture = Loadpicture(Full_Path_Of_The Picture_File)

If it is something that VB does not support, do you want to open the picture through an external program ? In that case, use the ShellExecute API function
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: need help with PICTURE

 
0
  #3
Mar 30th, 2006
Right. Something else you'll need to take into consideration is the size of the image. If you set it to be auto-size (the picture or image control) then it will change depending on the size of the picture.... if you don't, it will chop off the image so you can't see it all. Now, you could use an image control instead of a picturebox control, and set it's stretch property to true, which will shrink the image (or whatever) to the size of the image control, BUT it doesn't render the image with any kind of decent quality. When I wrote a picture viewer, I made a seperate form that was used as the viewer pane, and resized the entire form to a given ratio based on the size of the picturebox, so that way it didn't seem too flawed. Good luck with your project.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 14
Reputation: softwarecaz is an unknown quantity at this point 
Solved Threads: 0
softwarecaz softwarecaz is offline Offline
Newbie Poster

Re: need help with PICTURE

 
0
  #4
Apr 2nd, 2006
Hello the picture will only be the standard type Jpg type, all I want is any code just to view 20 pictures, am not to concern about the size, I could probably do that. All I really need is the code to view the pictures, preferably with two arrows for example if the user point left arrow it will go to picture 20 and if her presses the right arrow it will go to picture 1.

I think I could have a list box with the picture in, is that the way you would do it, can you please send me an attachment, or your code if you have done it, and I need something similar

Please help me, am really confused
Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 186
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: need help with PICTURE

 
0
  #5
Apr 2nd, 2006
I don't really have a code, but it's quite simple. You need a image or picturebox control to display the picture, u can't really do that in a list box.

Assuming there are 20 pictures, take an array for the filenames in the General Declarations section.

Dim strFiles(20) as string

Now put in the filenames in the array. Depending on ur project u can use a full path or a relative path.

strFiles(1) = PATH_OF_FILE1
strFiles(2) = PATH_OF_FILE2
....
strFiles(20) = PATH_OF_FILE20

Also declare a variable in the General Declarations section. This variable can be used as a counter.

Dim mCtr as integer

If there are 2 command buttons, cmdLeft and cmdRight, then in their click section write

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub cmdLeft_Click()
  2. if mCtr > 1 then
  3. mCtr = mCtr - 1
  4. end if
  5. Picture1.Picture = LoadPicture(strFiles(mCtr))
  6. End Sub

assuming Picture1 to be Picturebox that will display the picture

In the same way write for cmdRight

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub cmdRight_Click()
  2. if mCtr < 20 then
  3. mCtr = mCtr + 1
  4. end if
  5. Picture1.Picture = LoadPicture(strFiles(mCtr))
  6. End Sub

and ur pictures will be displayed. Use the 2 buttons to browse through the pictures
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: need help with PICTURE

 
0
  #6
Apr 2nd, 2006
Code Tags, Please!!!!
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 3
Reputation: carryyb is an unknown quantity at this point 
Solved Threads: 0
carryyb carryyb is offline Offline
Newbie Poster

Re: need help with PICTURE

 
0
  #7
Apr 3rd, 2006
Thanks for your code, however I still can’t make it work, the first picture does not even come up, it does execute but nothing happened, will it be possible for you to send an attachment in vb, so I can see how you make it work, you can put in any 2 or more pictures, once I know how it works I am sure I can make mine work too, don’t be tooo concern with the code, please help me make it work
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 186
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: need help with PICTURE

 
0
  #8
Apr 3rd, 2006
Most of the code I have already given. To see the first picture when the form loads, write in the form -> load section

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. strFiles(1) = PATH_OF_FILE1
  2. .....
  3. strFiles(20) = PATH_OF_FILE20
  4.  
  5. Image1.Picture = LoadPicture(strFiles(1))

If you are getting an error, please specify the error number & description.

Comatose, sorry about last post. Remembered this time :o
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: need help with PICTURE

 
0
  #9
Apr 3rd, 2006
:-|
Attached Files
File Type: zip SimplePic.zip (2.8 KB, 10 views)
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 4
Reputation: pattyandme is an unknown quantity at this point 
Solved Threads: 0
pattyandme pattyandme is offline Offline
Newbie Poster

Re: need help with PICTURE

 
0
  #10
Apr 8th, 2006
the syntax is not correct but this is how i would approch it

global piccnt as interger' in a modual

onform load 'set the 1st picture
piccnt = 0
pitcure1.picture = filepath & listbox.listindex(piccnt)

sub click arrow button right
piccnt = piccnt + 1
if piccnt >then listcount.indexcount then piccnt = 0
pitcure1.picture = filepath & listbox.listindex(piccnt)

end sub


sub click arrow button left
piccnt = piccnt - 1
if piccnt <then listcount.indexcount then piccnt = listindex.count.lastin the index
pitcure1.picture = filepath & listbox.listindex(piccnt)

end sub
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC