Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

TLMDRichEdit InsertGraphic background color

Good morning,

Problem insert a png image with its transparency or to modify the background color.

procedure TForm1.Button1Click(Sender: TObject);
var
  Picture: TPicture;
begin
  Picture := TPicture.Create;
  Picture.LoadFromFile('D:\Embarcadero\Dragon.png');
  LMDRichEdit.InsertGraphic(Picture.Graphic);
  Picture.Free;
end;

Thanks a lot
PNG
PNG
Capture.PNG
33K
Tagged:

Comments

  • 1 Comment sorted by Votes Date Added
  • problem solved 

    procedure TForm1.Button1Click(Sender: TObject);
    var
      Picture: TPicture;
      bmp: Tbitmap;
    begin
      Picture := TPicture.Create;
      Picture.LoadFromFile('D:\Embarcadero\Dragon.png');

      bmp := Tbitmap.Create;
      bmp.Assign(Picture.Graphic);
      bmp.Transparent := True;
      bmp.TransparentColor := clwhite;

      bmp.Canvas.Brush.Color := clwhite;
      bmp.Canvas.FillRect(Rect(0, 0, bmp.Width, bmp.Height));

      bmp.Canvas.Draw(0, 0, Picture.Graphic);
      LMDRichEdit.InsertBitmap(bmp);

      bmp.Free;
      Picture.Free;
    end;
    PNG
    PNG
    Capture.PNG
    42K
Sign In or Register to comment.