11 Mar 2009 @ 10:31 PM 

This is a simple extension method that can be added to retrieve a bitmap of any control. It can be as specific as a text box, or image viewer, or as general as your entire application.


public static Bitmap GetImage(this Control obj)
{
obj.CreateGraphics();
var bmp = new Bitmap(obj.Width, obj.Height);
obj.DrawToBitmap(bmp, new Rectangle(0, 0, obj.Width, obj.Height));
return bmp;
}

Posted By: boyd21
Last Edit: 11 Mar 2009 @ 10:31 PM

EmailPermalink
Tags
Tags: , , ,
Categories: .Net, Programming


 

Responses to this post » (699 Total)

 
Tags
Comment Meta:
RSS Feed for comments

 Last 50 Posts
Change Theme...
  • Users » 3
  • Posts/Pages » 30
  • Comments » 0
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

GeekPub



    No Child Pages.