473,378 Members | 1,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Load Picturebox images that were added to the project

IT
At run time I want to alternate the images in a picture box dependant on
some code. Add created a folder called graphics in my Project and dragged
the images there. Now at run time what is there location\path when they are
embedded into the project.

Thanks,
Phil
Nov 21 '05 #1
4 1888
This is code I used to pull icons when they are embedded. I believe you do
the same except for the System.Drawing object you use. As long as your
object can accept a stream, you should be good to go.

Dim p As System.Reflection.Assembly
p = System.Reflection.Assembly.GetExecutingAssembly()
Icons(0) = New System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"GreenBulb.ico"))
Icons(2) = New System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"RedBulb.ico"))
Icons(1) = New System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"YellowBulb.ico"))
Me.ntfSystemInfo.Icon = Icons(0)

Note: I seem to remember the "GreenBuild.ico" part being case sensitive. I
could be remembering wrong, it's been a while.

Hope it helps
Chris
"IT@ECommunity" <EC********@newsgroup.nospam> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
At run time I want to alternate the images in a picture box dependant on
some code. Add created a folder called graphics in my Project and dragged
the images there. Now at run time what is there location\path when they
are embedded into the project.

Thanks,
Phil

Nov 21 '05 #2
IT
Ok. I modified it to this:

Dim p As System.Reflection.Assembly
Dim Icons() As Icon

Private Sub ClaimsProcessStatus_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

p = System.Reflection.Assembly.GetExecutingAssembly()
Icons(0) = New System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
CHECKMRK.ICO"))

PictureBox1.Image = Icons(0).ToBitmap

End Sub

But it errors off on the Icons(0) line with the following error.
'null' is not a valid value for stream

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:ue**************@TK2MSFTNGP10.phx.gbl...
This is code I used to pull icons when they are embedded. I believe you
do the same except for the System.Drawing object you use. As long as your
object can accept a stream, you should be good to go.

Dim p As System.Reflection.Assembly
p = System.Reflection.Assembly.GetExecutingAssembly()
Icons(0) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"GreenBulb.ico"))
Icons(2) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"RedBulb.ico"))
Icons(1) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"YellowBulb.ico"))
Me.ntfSystemInfo.Icon = Icons(0)

Note: I seem to remember the "GreenBuild.ico" part being case sensitive.
I could be remembering wrong, it's been a while.

Hope it helps
Chris
"IT@ECommunity" <EC********@newsgroup.nospam> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
At run time I want to alternate the images in a picture box dependant on
some code. Add created a folder called graphics in my Project and dragged
the images there. Now at run time what is there location\path when they
are embedded into the project.

Thanks,
Phil


Nov 21 '05 #3
IT
Oops. I must have changed the icons property to content at some point in
time.

It doesn't error off now but it does just show a black square. Is there
another control I should be using to show an Icon?

"IT@ECommunity" <EC********@newsgroup.nospam> wrote in message
news:uz**************@TK2MSFTNGP14.phx.gbl...
Ok. I modified it to this:

Dim p As System.Reflection.Assembly
Dim Icons() As Icon

Private Sub ClaimsProcessStatus_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

p = System.Reflection.Assembly.GetExecutingAssembly()
Icons(0) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
CHECKMRK.ICO"))

PictureBox1.Image = Icons(0).ToBitmap

End Sub

But it errors off on the Icons(0) line with the following error.
'null' is not a valid value for stream

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com>
wrote in message news:ue**************@TK2MSFTNGP10.phx.gbl...
This is code I used to pull icons when they are embedded. I believe you
do the same except for the System.Drawing object you use. As long as
your object can accept a stream, you should be good to go.

Dim p As System.Reflection.Assembly
p = System.Reflection.Assembly.GetExecutingAssembly()
Icons(0) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"GreenBulb.ico"))
Icons(2) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"RedBulb.ico"))
Icons(1) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"YellowBulb.ico"))
Me.ntfSystemInfo.Icon = Icons(0)

Note: I seem to remember the "GreenBuild.ico" part being case sensitive.
I could be remembering wrong, it's been a while.

Hope it helps
Chris
"IT@ECommunity" <EC********@newsgroup.nospam> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
At run time I want to alternate the images in a picture box dependant on
some code. Add created a folder called graphics in my Project and
dragged the images there. Now at run time what is there location\path
when they are embedded into the project.

Thanks,
Phil



Nov 21 '05 #4
IT
It is all good. I edited the icons background and changed the sizemode to
autosize.

Thanks for the help Chris

"IT@ECommunity" <EC********@newsgroup.nospam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Oops. I must have changed the icons property to content at some point in
time.

It doesn't error off now but it does just show a black square. Is there
another control I should be using to show an Icon?

"IT@ECommunity" <EC********@newsgroup.nospam> wrote in message
news:uz**************@TK2MSFTNGP14.phx.gbl...
Ok. I modified it to this:

Dim p As System.Reflection.Assembly
Dim Icons() As Icon

Private Sub ClaimsProcessStatus_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

p = System.Reflection.Assembly.GetExecutingAssembly()
Icons(0) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
CHECKMRK.ICO"))

PictureBox1.Image = Icons(0).ToBitmap

End Sub

But it errors off on the Icons(0) line with the following error.
'null' is not a valid value for stream

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com>
wrote in message news:ue**************@TK2MSFTNGP10.phx.gbl...
This is code I used to pull icons when they are embedded. I believe you
do the same except for the System.Drawing object you use. As long as
your object can accept a stream, you should be good to go.

Dim p As System.Reflection.Assembly
p = System.Reflection.Assembly.GetExecutingAssembly()
Icons(0) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"GreenBulb.ico"))
Icons(2) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"RedBulb.ico"))
Icons(1) = New
System.Drawing.Icon(p.GetManifestResourceStream(Me .GetType(),
"YellowBulb.ico"))
Me.ntfSystemInfo.Icon = Icons(0)

Note: I seem to remember the "GreenBuild.ico" part being case
sensitive. I could be remembering wrong, it's been a while.

Hope it helps
Chris
"IT@ECommunity" <EC********@newsgroup.nospam> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
At run time I want to alternate the images in a picture box dependant
on some code. Add created a folder called graphics in my Project and
dragged the images there. Now at run time what is there location\path
when they are embedded into the project.

Thanks,
Phil



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: antishok | last post by:
Hi, I'm writing a page which has a somewhat similar folder tree to that of the windows explorer, where each folder is made of a <SPAN> tag consisting of the folder image (closed or open) and the...
2
by: thedebugger | last post by:
Dear Friends, I am making one RSS News Reader Desktop application in c#. Where I will show the images from website. I am generating xml file on server. like http://www.zeetelevision.com/myxml.xml...
12
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small console application in C++ (unmanaged) that uses...
3
by: EricJ | last post by:
imagine having a fixed picture in a form, if the user clicks in the picture an x has to be displayed where the user clicked (so far not much problems). But the user can make as much x'ses as he...
2
by: David Ricker | last post by:
I have created a PictureBox control which can have it's Image property directly bound to an image field in a database. This works perfectly for showing the images that are in the database. When I...
5
by: BrianW | last post by:
I am working on a program that has multiple picturebox controls that a user is allowed to move around which are contained within a panel control for visual placement. In my mousedown event, I set...
2
by: Alejandro Lapeyre | last post by:
I am using a ImageList with a bitmap that contains all the images. I am currently saving the bitmap in a PictureBox, and load into the ImageList when the form loads. How can I save the bitmap...
5
by: Fao, Sean | last post by:
I'm working on a Windows application (VS 2005) that I will need to be able to select images I've added to a FlowLayoutPannel. I was attempting to select the various PictureBoxes and noticed that...
3
by: =?Utf-8?B?UGVy?= | last post by:
I'm working on a project that have to load an display pcx-images in a PictureBox-control. When I try to load the file with Bitmap.FromFile I get an exception. Does anybody have an idea ?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.