Solved

how to assign image to windows forms picture control at run time

Posted on 2006-11-08
3
303 Views
Last Modified: 2008-03-03
Hi,
I need sample code that show me how to assign images to picture control(or any other control I don't know)
at program runtime so that I can inser article of data that the images will be part of it.
any help is welcomed

Rgards
Hatem
0
Comment
Question by:shang3000
3 Comments
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 17902393
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 200 total points
ID: 17902547
Simply?...

    pictureBox1.Image = Image.FromFile(@"c:\someImage.bmp");
0
 
LVL 13

Accepted Solution

by:
iHadi earned 300 total points
ID: 17904038
It depends on where your image resides:

            // from another picturebox
            pictureBox1.Image = pictureBox2.Image;

            // from a file, load the image to memory then to picturebox
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap  (@"C:\a.jpg");
            // from an image in memory
            pictureBox1.Image = bmp;

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question