Wednesday, July 30, 2008

Easton Sv12 -10 Reviews

Dot Net (C #): Screenshot of a create

following two methods are needed for a create screenshot of one control and saving it to a file:
  1:   public   static  Bitmap take screenshot (Control pControl) 
  2:  {
  3:  Bitmap bmp =   new Bitmap (pControl.Width, pControl.Height); 
  4:  pControl.DrawToBitmap (bmp, Rectangle.FromLTRB (0, 0, pControl.Width, pControl.Height)); 
  5:    return bmp; 
  6: } 
  7:  
  8:     public     static   Boolean saveScreenshotToFile(Control pControl, String pFilename) 
      9:    { 
     10:          try   
     11:        { 
     12:            takeScreenshot(pControl).Save(pFilename); 
     13:              return     true  ; 
     14:        } 
     15:          catch   (Exception) 
     16:        { 
     17:              return     false  ; 
  18:  
 } 19:}  

The first method takes a screenshot and saves it in a bitmap object. The second method can be used to directly save the screenshot to a file.

0 comments:

Post a Comment