What is the best solution to create a resizable png image block (no borders) having the same properties as a standard TDiagramBlock?
I want to draw a png image directly on the diagram by clicking a custom button. The standard solution is to draw a TDiagramBlock and change the background image but it isn't possible to remove the border.
Thanks for the support.
Dear members,
I found the solution:
with atDiagram1.Blocks[0] do
begin
Shape := bsNoShape;
Bitmap.LoadFromFile('myBitmap.bmp');
end;
But I've got a error message when loading a .png file ...
with atDiagram1.Blocks[0] do
begin
Shape := bsNoShape;
Picture.LoadFromFile('myPNG.png');
end;
ERROR MESSAGE:
Unknown picture file extension
What causes this ERROR ?
Thanks.
You must use PgnImage unit.
Wagner,
I used the following code:
procedure TForm1.Button2Click(Sender: TObject);
var p: TPngImage;
begin
p:=TPngImage.create;
try
p.LoadFromFile('mypng.png');
atDiagram1.Blocks[0].Assign(p);
finally
freeandnil(p);
end;
end;
I still get a error message:
Cannot assign a TPngImage to a TDiagramBlock
Please can you help me?
Thanks
use
Thanks Wagner, problem solved.