• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 554
  • Last Modified:

Learning - trying to have a default image with the picturebox

*need quick*

Using VS 2005, vb.net I am trying to have a default image, an image loaded when nothing is selected yet, like onLoad. In the control box of psbCam1 I used the IntitialImage and I clicked the radio button for local resource, import and viola put my picture in but when I run the program it doesn't show. What am I doing wrong? Also I want this to be used with other users on their machine so maybe I am just going about this all wrong. Please help!
0
Kit_Kat111
Asked:
Kit_Kat111
  • 5
  • 3
  • 2
  • +1
2 Solutions
 
fruhjCommented:
Local resources are pretty cool - they get compiled in the app and you can use them without much worry about thier location.

I have a bunch of icons on my menus that way.

(PS speaking of icons, there's a bunch of them in a zip file located on your hard drive (visual studio 2005): C:\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary)

as far as the default picture,
I have one on my app, it's in a picture box, and the image property is set to System.drawing.bitmap (which I pulled from the (...) button on the right - mine says localresource)


0
 
Kit_Kat111Author Commented:
Thanks for response!
so in debug mode I won't see those pictures that I have as defaults?  I thought the system.drawing.bitmap were the error pictures you can associate with it?

ty
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
The InitialImage property is used to display something in the PictureBox "while the main image is loading":
http://msdn2.microsoft.com/en-us/library/system.windows.forms.picturebox.initialimage.aspx

I'm not sure of it's proper usage...but I think that would most likely be used when the main image is large and might take awhile to load so you could use InitialImage to display something smaller while the main image loads?  I can't think of an easy way to test this in a WinForms app.  Seems to be more appropriate for a web page...

If you want an Image to be there "by default" then set the Image property to your "initial image".  It will display and then you can change it at run-time via code in response to whatever event you want.
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
Kit_Kat111Author Commented:
Okay I did just that but didn't compile, the "default" image didn't show up in debug mode.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
So you selected your PictureBox and then down in the Image property you clicked the ellipses (...) and used the "Import" button with a Local Resource?

For me the Image is visible in the IDE at design-time.

Try compiling.  If there are errors then the version you ran was an old one.
0
 
Kit_Kat111Author Commented:
Thanks for your response. That does sound logical. I will compile once I get this next section done, I just can't figure out how to set it up -maybe you can help?
0
 
Kit_Kat111Author Commented:
Okay I compiled and still no default pictures....
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Something else is going on there...

What happens if you create a new project with just a picturebox in a form and set the pbs Image property?
0
 
klb37777Commented:
Well I tried the same thing on a different machine and it didn't work like I wanted. I thought the image would be there until another image was specifed like from a ddl or something, BUT I did figure out another solution. Quite simple in fact, just assigned the image like normal and when I select from ddl it changes it. Thanks for helping me.....
0
 
klb37777Commented:
The image was small. And since you and Fruhj helped me understand if I was doing this right I am going to split the points. Hope that is cool with you both, it seems fair to me. Thanks again for the help.
0
 
Kit_Kat111Author Commented:
Wow...that is an old log in from an old job. oops sorry. I will send an e-mail. That is what I get for logging into an different computer. Thanks again
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now