Bitmap questions

G

Guest

I don't like the following way to create a bitmap.
Bitmap bm = new Bitmap("C:\\MyBitmap.bmp");

Can I create a bitmap from the bitmap in a picturebox?

Thanks.
 
A

Andy Bates

Several ways to create a bitmap (or any other image for that matter).

Image i = Image.FromFile("filename.jpg");
i.Save("filename.bmp");

The picturebox has a property called Image which is the internal image
class.

You can call the same methods on that to manipulate it.

- Andy
 
B

Bob Powell [MVP]

You have to put the bitmap into the PictureBox to display it, why create
another one from it?

Perhaps you're thinking of doing something like:

Graphics g=myPictureBox.CreateGraphics();
g.DrawStuff
Bitmap b=myPictureBox.Image;

In which case you are labouring under a pile of misaprehension and should
probably go read the GDI+ FAQ.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top