printing bitmap from Imagelist

printing bitmap from Imagelist

Post by Hassan Majed » Fri, 04 Jul 2003 18:49:11



Hi,

i want to print the Bitmaps from Imagelist,

with Printer do begin
   BeginDoc;
   bm:= TBitmap.Create;
   ImageList1.GetBitmap(0,bm);
  Canvas.Draw(100,100,b1);
  EndDoc;
end;

which does not work!
But if i use "bm.LoadfromFile('b1.bmp')",  and load the bitmap, it works
properly.
or when i save the bitmap in to a file an load it again, works too

with Printer do begin
   Begindoc;
   bm:= TBitmap.Create;
   ImageList1.GetBitmap(0,bm);
   bm.SavetoFile('b1.bmp');
   bm.LoadfromFile('b1.bmp');
   Canvas.Draw(100,100,b1);
   EndDoc;
end;

any idea?
Hassan

 
 
 

1. Printing bitmap from imagelist problem

How can I extract a bitmap from a imagelist AND print it?

I can extract a bitmap from a imagelist and assign it to a image.
I can also print a bitmap from a image but not when I assign it, only
when I put it there with the object inspector.

If I comment out the 'image1.picture.assign' line then the bitmap loaded
into the image with the object inspector, will print, but if I don't the
bitmap 'B' will be extracted and displayed in the image, but nothing will
print.

procedure TForm1.Button1Click(Sender: TObject);
var
  ScaleX,ScaleY: integer;
  R: TRect;
  B: TBitmap;
begin
  B := TBitmap.Create;
  ImageList1.GetBitmap(2,B);
  Image1.Picture.Assign(B);
  Printer.BeginDoc;
  with Printer do
  try
    ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
    ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
    R := Rect(0,0,16*ScaleX,16*ScaleY);
    Canvas.StretchDraw(R,Image1.Picture.Bitmap);
  finally
    B.Free;
    EndDoc;
    end;
end;

What am I missing?

Thanks

2. How to get a 3/8" bleed with crop marks?

3. Newbie -- Copying a bitmap to an imagelist

4. Optimal vertex buffer size...

5. ImageList Bitmap

6. OpenGL Frequently Asked Questions [2/3]

7. Loading bitmap into imagelist headache

8. Controlling pixel color in Overlay Planes

9. Transparent color in ImageList/ImageList Editor

10. Imagelist Printing Problem

11. Device independent bitmap + printing of a bitmap

12. Print a bitmap with Printer.Print

13. Print Setup and printing a bitmap