Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS Diagram Studio
Adding metafiles as block on the toolbar

procedure TForm1.atDiagram1InsertDControl(Sender: TObject; ADControl: TDiagramControl);
begin
  if UpperCase(ADControl.DControlID) = 'MYBLOCK' then
  begin
    With ADControl As TDiagramBlock do
    begin
      Shape := bsNoShape;
      Metafile.LoadFromFile('C:\MyMetafile.wmf');
    end;
  end else
  if UpperCase(ADControl.DControlID) = 'MYOTHERBLOCK' then
  begin
    With ADControl As TDiagramBlock do
    begin
    Color := clYellow;
    end;
  end;
end;

initialization

RegisterDControl(TDiagramBlock, 'MyBlock', 'This is a caption for my block', 'My category');
RegisterDControl(TDiagramBlock, 'MyOtherBlock', 'This is a caption for my other block', 'My category');
Note: Metafiles are not supported in Direct2D, which is default drawing engine for TMS Diagram Studio. You can force using GDI+ though:
atDiagram1.GraphicLib := dglGdiPlus;