?
Solved

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

Posted on 2006-11-08
3
Medium Priority
?
316 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 17902393
0
 
LVL 86

Assisted Solution

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

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

Accepted Solution

by:
iHadi earned 1200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 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