Bitmap questions

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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.
 
Back
Top