Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvStringGrid
Saving TAdvStringGrid to a JPEG file

With code below, the output of TAdvStringGrid is sent to a JPEG file:
var
  pBitmap: TBitmap;
  jp: TJPEGImage;
  R: TRect;
begin
  pBitmap := TBitmap.Create; //create a new instance of a bitmap
  jp := TJPEGImage.Create;   //create new instance of a jpg file
  R := Rect(0,0,950,760);    //parameters for rectangle
  pBitmap.Height := 622;     //set bmp height
  pBitmap.Width := 812;      //set bmp width
  AdvStringGrid1.PrintPreview(pBitmap.Canvas,R); //call Preview to paint to BMP canvas
  jp.Assign(pBitmap); //get picture from bitmap for JPG Image
  jp.SaveToFile('c:\temp\Grid.jpg'); //save picture as JPG File
  pBitmap.Free;
  jp.Free;
end;