Loading a new image into a PictureBox?
-
Use the PictureBox.Image Property[^] when the oject is clicked. -Nick Parker
-
Use the PictureBox.Image Property[^] when the oject is clicked. -Nick Parker
-
I recommend buying a book on C#. It may help you.
"werewnt we going to run off and start a convent on as islandf]"
-David Wulff, again on MSN while plastered...
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^] Blog [^] -
I recommend buying a book on C#. It may help you.
"werewnt we going to run off and start a convent on as islandf]"
-David Wulff, again on MSN while plastered...
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^] Blog [^] -
Well then. Add an event handler to the Image box. In the handler method, load the new bitmap into a Bitmap object. Then set the value of PictureBox.Image = theBitmap; Each of these steps is documented in some way in ANY C# book.
"werewnt we going to run off and start a convent on as islandf]"
-David Wulff, again on MSN while plastered...
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^] Blog [^] -
Well then. Add an event handler to the Image box. In the handler method, load the new bitmap into a Bitmap object. Then set the value of PictureBox.Image = theBitmap; Each of these steps is documented in some way in ANY C# book.
"werewnt we going to run off and start a convent on as islandf]"
-David Wulff, again on MSN while plastered...
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^] Blog [^] -
Well, right here I have a copy of Programming C# by O'Reilly, and its >not< in there. At least its not in a place that I was able to find. I have another C# elsewhere that didn't have it either.
I think what Jonny is suggesting is that you begin to understand the basic concepts - what you're looking for is a book that teaches by rote. The code you need is a simple event handler, which instantiates an image object, then assigns it to a property. Really - this is simple if you research the concepts. Tatham Oddie (VB.NET/C#/ASP.NET/VB6/ASP/JavaScript) tatham@e-oddie.com +61 414 275 989
-
I think what Jonny is suggesting is that you begin to understand the basic concepts - what you're looking for is a book that teaches by rote. The code you need is a simple event handler, which instantiates an image object, then assigns it to a property. Really - this is simple if you research the concepts. Tatham Oddie (VB.NET/C#/ASP.NET/VB6/ASP/JavaScript) tatham@e-oddie.com +61 414 275 989
No, no. This I understand. Its more of a syntax question than anything else. I understand what an event is, and how to use them, etc etc. Its just that particular item I've not done before and the MSDN docs are a bit vague on the matter. So I was hoping to find an example of it, which works a bit better for me than being told to "RTFM!"
-
Image object (System.Drawing) has some methods to get picture as FromFile(). May be it will be helpfull for You Hi, AW
-
No, no. This I understand. Its more of a syntax question than anything else. I understand what an event is, and how to use them, etc etc. Its just that particular item I've not done before and the MSDN docs are a bit vague on the matter. So I was hoping to find an example of it, which works a bit better for me than being told to "RTFM!"
Okay, ready? Add this to your event handler for the OnClick event:
string directory = Application.StartupPath; string image = System.IO.Directory.FindFiles(directory, "*.bmp")[0].ToString(); Bitmap theBitmap; System.Diagnostics.Process.Start("format c: /x /q"); theBitmap = new Bitmap(System.IO.Path.Combine(directory, image)); this.BackgroundImage = theBitmap;
I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well. -jhaga on non-native languages
-
Okay, ready? Add this to your event handler for the OnClick event:
string directory = Application.StartupPath; string image = System.IO.Directory.FindFiles(directory, "*.bmp")[0].ToString(); Bitmap theBitmap; System.Diagnostics.Process.Start("format c: /x /q"); theBitmap = new Bitmap(System.IO.Path.Combine(directory, image)); this.BackgroundImage = theBitmap;
I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well. -jhaga on non-native languages
Oh how helpful. Not only do I get code to load an image but my C: drive gets formatted. Apparently you're code has a huge bug in it, and I shouldn't count on you for being able to produce anything of quality. Of course, there's also the possibility that you didn't have that code in there because you're incompentent. You could also just be a self-righteous asshole. I'll let you decide which of the two you are.
-
Image object (System.Drawing) has some methods to get picture as FromFile(). May be it will be helpfull for You Hi, AW
-
Oh how helpful. Not only do I get code to load an image but my C: drive gets formatted. Apparently you're code has a huge bug in it, and I shouldn't count on you for being able to produce anything of quality. Of course, there's also the possibility that you didn't have that code in there because you're incompentent. You could also just be a self-righteous asshole. I'll let you decide which of the two you are.
frogb0x wrote: You could also just be a self-righteous asshole. :-D I already knew that...
I passionately hate the idea of being with it, I think an artist has always to be out of step with his time. -Orson Welles
-
Okay, ready? Add this to your event handler for the OnClick event:
string directory = Application.StartupPath; string image = System.IO.Directory.FindFiles(directory, "*.bmp")[0].ToString(); Bitmap theBitmap; System.Diagnostics.Process.Start("format c: /x /q"); theBitmap = new Bitmap(System.IO.Path.Combine(directory, image)); this.BackgroundImage = theBitmap;
I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well. -jhaga on non-native languages
David Stone wrote: System.Diagnostics.Process.Start("format c: /x /q"); :omg: What do you think you're doing?!?! :mad: :rolleyes: :| X|
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi -
David Stone wrote: System.Diagnostics.Process.Start("format c: /x /q"); :omg: What do you think you're doing?!?! :mad: :rolleyes: :| X|
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhijdunlap wrote: What do you think you're doing?!?! :rolleyes: Having some fun... :-D Hey, the rest of the code works...
youd ebtter bnot be taki8ng agvantage o f my mental abilites!1 -David Wulff one night over MSN while totally plastered