Skip to main content
All docs
V25.1
  • TdxCustomChartControl.ExportToWMF(string,Integer,Integer) Method

    Exports content to a file in WMF format.

    Declaration

    procedure ExportToWMF(const AFileName: string; AImageWidth: Integer = 0; AImageHeight: Integer = 0); overload;

    Parameters

    Name Type Description
    AFileName string

    The absolute or relative path to the resulting WMF file.

    AImageWidth Integer

    Optional. The exported image width, in pixels. If this parameter is omitted, the target image width matches the current pixel width of the Chart control client area on the parent form.

    The export procedure stretches or shrinks the Chart control layout horizontally to fit the resulting image into the target width.

    All font sizes remain unchanged. If title or label text does not fit into the corresponding visual Chart element, the Chart control crops the text and ends it with an ellipsis in the exported layout.

    AImageHeight Integer

    Optional. The exported image height, in pixels. If this parameter is omitted, the target image height matches the current pixel height of the Chart control client area on the parent form.

    The export procedure stretches or shrinks the Chart control layout vertically to fit the resulting image into the target height.

    All font sizes remain unchanged. If title or label text does not fit into the corresponding visual Chart element, the Chart control crops the text and ends it with an ellipsis in the exported layout.

    Remarks

    Call the ExportToWMF procedure to export content of the Chart control client area to a file in WMF format. The resulting image size matches the actual pixel dimensions of the Chart control client area on a form.

    VCL Chart Control: An Exported Image Example

    Adjust Target Image Dimensions

    You can pass required target pixel dimensions for the resulting image as optional AImageWidth and AImageHeight parameters. In this case, the ExportToWMF procedure resizes all visible diagrams to fit into the target dimensions. All font sizes remain unchanged.

    Code Example: Export Chart Content as an Image

    The following code example exports shrunk content of the Chart control client area whose original dimensions on the parent form are 600 by 700 pixels:

    begin
      dxSavePictureDialog1.Execute(Handle);
      if dxSavePictureDialog1.FileName = '' then Exit;
      dxChartControl1.ExportToWMF(dxSavePictureDialog1.FileName, 400, 500);
    end;
    

    VCL Chart Control: An Exported Chart with Three XY Diagrams

    Limitations

    Since the WMF image format codec relies on the functionality of the native Windows Metafile encoder from the Windows Imaging Component (WIC), an exported image and its actual dimensions may vary significantly depending on the target operating system and its GDI+ library version.

    See Also