Board index » delphi » Clipboard contents (Gif/Jpeg/Bmp) to DB BlobField?

Clipboard contents (Gif/Jpeg/Bmp) to DB BlobField?

How do I paste from the Clipboard a stored Gif/Jpeg image?

and is there a way to determine if the Clipboard is holding a Gif vs. Jpeg
vs. Bmp?

I managed to do the Bitmap, but I have had no luck with the Gif and Jpeg
formats...

Here is what I did for the Bitmap:
==========================
    if (not Clipboard.HasFormat(CF_BITMAP)) then exit;
    aBmp:=TBitmap.Create;
    try
      aBmp.Assign(Clipboard);
      MS:=TMemoryStream.Create;
      try
        aBmp.SaveToStream(MS);
        MS.Position:=0;
        try
          TGraphicField(tblImage.FieldByName('Image')).LoadFromStream(MS);
        except
          ShowMessage('Error in assigning Clipboard bitmap');
        end;
      finally
        MS.Free;
      end;
    finally
      aBmp.Free;
    end;

Any ideas are appreciated!

-- Raymond
Raymond J. Schappe
Isthmus Technology Solutions, LLC
______________________________________

 

Re:Clipboard contents (Gif/Jpeg/Bmp) to DB BlobField?


Raymond,

I have placed a demo in the attachments section which shows how to deal
with JPEG files. GIF would be similar (I guess!)

Incidentally you must use a TBlobFileld (TGraphicField is for Bitmaps)
and TDBImage is out, you have to display in a TImage. The demo shows
how.

Bob
---
Sent using Virtual Access 5.01 - download your freeware copy now
http://www.atlantic-coast.com/downloads/vasetup.exe

Re:Clipboard contents (Gif/Jpeg/Bmp) to DB BlobField?


Bob,

I downloaded your example! Thank you very much!!!

I have played around with it a bit but I still have some "learning" to
do!<g>

Thanks again,
-- Raymond
Raymond J. Schappe
Isthmus Technology Solutions, LLC
______________________________________

Quote
> I have placed a demo in the attachments section which shows how to deal
> with JPEG files. GIF would be similar (I guess!)

> Incidentally you must use a TBlobFileld (TGraphicField is for Bitmaps)
> and TDBImage is out, you have to display in a TImage. The demo shows
> how.

Other Threads