Click here to Skip to main content
15,912,329 members
Home / Discussions / C#
   

C#

 
GeneralRe: SmartClient Pin
Michael P Butler13-Jan-05 9:04
Michael P Butler13-Jan-05 9:04 
Generalbinary file reading and converting Pin
bwagz12-Jan-05 18:19
bwagz12-Jan-05 18:19 
Generalerror in this c# program Pin
dhol12-Jan-05 17:55
dhol12-Jan-05 17:55 
GeneralRe: error in this c# program Pin
leppie12-Jan-05 21:49
leppie12-Jan-05 21:49 
GeneralRe: error in this c# program Pin
dhol13-Jan-05 1:03
dhol13-Jan-05 1:03 
GeneralRe: error in this c# program Pin
leppie13-Jan-05 4:57
leppie13-Jan-05 4:57 
GeneralRe: error in this c# program Pin
dhol13-Jan-05 16:52
dhol13-Jan-05 16:52 
GeneralChange image property of a picturebox object at run time Pin
Einar Kvandahl12-Jan-05 15:45
Einar Kvandahl12-Jan-05 15:45 
How can I set the image property of a picturebox object at run time?
I have added to images (jpg) to my solution both with build action Embedded Resource, and I want to switch at run time which image is displayed. I can not use the ImageList because the image size exceeds 256x256 and is not the same for both pictures. (I might want to include more pictures in the future).

I also know that I can use the following code:
this.myPictureBox.Image = new Bitmap("C:\\myfolder\\myImage.jpg");

but if I use that code there better be an image at that location and that is not what I want. I want to embedd the image in the exe and then populate the image property of the picture box with the embedded images at runtime.

I thought a little more about this problem and I think I want to create an array of bitmaps and then load all the images into the bitmap array then I can use the following code to change the picturebox image property at runtime:

private void ChangeImage(int ImgIndex)
{
  this.myPictureBox.Image = this.myBitmapArray[ImgIndex];
}


Well the problem still remains to find a way to load an image into a bitmap object. It is very easy to do if I specify the path and the filename but again that is not something I want to do.

I did find some information using the System.Reflection.Assembly class, but I could not quite figure out how to load the resource that is embedded.

Any assistance would be greatly appreciated.

Sincerely,
Einar
GeneralRe: Change image property of a picturebox object at run time Pin
Adam Goossens13-Jan-05 1:01
Adam Goossens13-Jan-05 1:01 
GeneralClass / Database design document Pin
econner12-Jan-05 15:17
econner12-Jan-05 15:17 
GeneralRe: Class / Database design document Pin
Adam Goossens13-Jan-05 1:05
Adam Goossens13-Jan-05 1:05 
GeneralWindows ContextMenu... Pin
new_phoenix12-Jan-05 13:45
new_phoenix12-Jan-05 13:45 
GeneralRe: Windows ContextMenu... Pin
Guinness4Strength12-Jan-05 13:52
Guinness4Strength12-Jan-05 13:52 
GeneralRe: Windows ContextMenu... Pin
new_phoenix13-Jan-05 9:24
new_phoenix13-Jan-05 9:24 
GeneralDirectX 9 & c# problem Pin
dratcha12-Jan-05 12:28
dratcha12-Jan-05 12:28 
GeneralSimple ListBox Event Pin
Snowjim12-Jan-05 12:27
Snowjim12-Jan-05 12:27 
GeneralRe: Simple ListBox Event Pin
Stefan Troschuetz12-Jan-05 21:41
Stefan Troschuetz12-Jan-05 21:41 
GeneralRe: Simple ListBox Event Pin
Snowjim12-Jan-05 23:21
Snowjim12-Jan-05 23:21 
GeneralRe: Simple ListBox Event Pin
Stefan Troschuetz12-Jan-05 23:30
Stefan Troschuetz12-Jan-05 23:30 
GeneralVS.NET Add-In Problem Pin
Guinness4Strength12-Jan-05 12:13
Guinness4Strength12-Jan-05 12:13 
GeneralARRAY LIST Pin
suthagar12-Jan-05 10:29
suthagar12-Jan-05 10:29 
GeneralRe: ARRAY LIST Pin
Christian Graus12-Jan-05 10:53
protectorChristian Graus12-Jan-05 10:53 
Generalnot post back Pin
Ahmed Galal12-Jan-05 7:40
Ahmed Galal12-Jan-05 7:40 
GeneralRe: not post back Pin
Christian Graus12-Jan-05 8:56
protectorChristian Graus12-Jan-05 8:56 
GeneralRe: not post back Pin
Ahmed Galal12-Jan-05 10:12
Ahmed Galal12-Jan-05 10:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.