Copy/Paste of Grayscale Bitmaps reduce Colors (HOW/WHY)

I have a bitmap which I have embedded in a tPicture. While in delphi the
bitmap has 256 colors, when I use the following code:

procedure actCopySourceExecute(Sender: TObject);
var
  MyFormat                      : Word;
  Bitmap                        : TBitMap;
  AData         : THandle;
  APalette      : HPALETTE;
begin
        imgSource.Picture.RegisterClipboardFormat(MyFormat,tGraphicClass
(imgSource.Picture.Bitmap));
        imgSource.Picture.Bitmap.SaveToClipBoardFormat(MyFormat,AData,APalette);
        ClipBoard.SetAsHandle(MyFormat,AData);
end;

I get a 32 color image out when pasted into another graphics program. Also
when I copy a 256 color (grayscale) image back into my delphi program with:

procedure actPasteSourceExecute(Sender: TObject);
begin
        imgSource.Picture.Bitmap.LoadFromClipboardFormat(
                cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0
        );
end;

I again get a 32 color image.

Why? What is the proper way to copy a 256 color bitmap into a tBitmap?

Thanks,

Ryan Groth

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own