我用image控件做了一个签名程序。但每次保存.bmp位图后,背景不能为透明。我现在想要的是保存的图片只有用户签的字,其他地方为透明色。这样导入word才不会遮住其他字体。哪位高手能解决?

解决方案 »

  1.   

    bmp就不支持透明,你要保存成bmp就不行
      

  2.   

    delphi帮助里写的:
    Transparent has no effect unless the Picture property specifies a TBitmap object. 
    朋友的E文应该比我好,这句的意思是说如果picture的属性不指定为TBitmap对象的话,transparent属性是没用的。听别人说图片必须是jpg或GIF的
    透明色为左下角那点的着色仅是听说
      

  3.   

    你的透明如果指的是混合半透明,Image 无能为力,要靠编程计算。
    如果指的是抠单色,就可以用上面的方法,把Image 的Transp 的值设为TRUE
      

  4.   

    to:Kshape
       不是混合半透明,我实现了一个手写文字的功能,保存后成为图片,然后导入到word中,但是背景总是白色的,我就算在保存时候转化为jpg格式也不行。
    这使我的代码:
    procedure Tfrm_set.FormCreate(Sender: TObject);
    var
      Bitmap: TBitmap;
    begin
      Screen.Cursors[mycur]:=LoadCursor(hinstance,'mycur');
      Bitmap := nil;
      try
        Bitmap := TBitmap.Create;
        BitMap.PixelFormat:=pf24bit;
        Bitmap.Transparent := True;
        Bitmap.TransparentColor:=clWhite;
       // Bitmap.TransparentMode := tmAuto;
        Bitmap.Width := Image.Width;
        Bitmap.Height := Image.Height;
        Image.Picture.Bitmap := Bitmap;
      finally
        Bitmap.Free;
      end;
       image.Cursor:=mycur;
    end;procedure Tfrm_set.saveClick(Sender: TObject);
    var
     jp: TJPEGImage;
    begin
      image.Picture.Bitmap.TransparentColor :=clWhite;
      image.transparent:=true;
       jp := TJPEGImage.Create;
      try
       jp.Assign(Image.Picture.Bitmap); // Assign the BitMap to MyJpeg object
       jp.CompressionQuality:=StrToInt('75');
       jp.Compress;
       jp.Transparent:=true;
       jp.SaveToFile('c:\yinzhang.bmp'); // Save the JPEG to Disk
      finally
        jp.Free;
      end;