⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 teeemfoptions.pas

📁 第三方控件:PaintGrid.pas 网格型仪表控件源文件 Mymeter.pas 圆型仪表控件源文件 Project1是这两个控件的使用范例。 该
💻 PAS
字号:
{*******************************************}
{ TeeChart Pro Metafile exporting           }
{ Copyright (c) 1995-2005 by David Berneda  }
{         All Rights Reserved               }
{*******************************************}
unit TeeEmfOptions;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  Windows, Messages,
  {$ENDIF}
  SysUtils, Classes,
  {$IFDEF CLX}
  QGraphics, QControls, QForms, QDialogs, QStdCtrls,
  {$ELSE}
  Graphics, Controls, Forms, Dialogs, StdCtrls,
  {$ENDIF}
  {$IFDEF D9}
  Types,
  {$ENDIF}
  TeeProcs, TeeExport;

type
  TEMFOptions = class(TForm)
    CBEnhanced: TCheckBox;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TEMFExportFormat=class(TTeeExportFormat)
  private
    FProperties: TEMFOptions;
    function GetEnhanced: Boolean;
    procedure SetEnhanced(const Value: Boolean);
  protected
    Procedure DoCopyToClipboard; override;
    function FileFilterIndex: Integer; override;
    procedure IncFileFilterIndex(var FilterIndex: Integer); override;

  {$IFDEF CLR}
  public
  {$ENDIF}
    function WantsFilterIndex(Index:Integer):Boolean; override;
  public
    function Description:String; override;
    function FileExtension:String; override;
    function FileFilter:String; override;
    function GraphicClass:TGraphicClass; override;
    Function Metafile:TMetafile;
    Function Options(Check:Boolean=True):TForm; override;
    Procedure SaveToStream(Stream:TStream); override;

    property Enhanced:Boolean read GetEnhanced write SetEnhanced;
  end;

implementation

{$IFNDEF CLX}
{$IFNDEF LCL}
{$R *.DFM}
{$ENDIF}
{$ELSE}
{$R *.xfm}
{$ENDIF}

Uses {$IFDEF CLX}
     QClipbrd,
     {$ELSE}
     Clipbrd,
     {$ENDIF}
     TeCanvas, TeeConst;

function TEMFExportFormat.Description:String;
begin
  result:=TeeMsg_AsEMF;
end;

function TEMFExportFormat.FileFilter:String;
begin
  result:=TeeMsg_EMFFilter;
end;

function TEMFExportFormat.FileExtension:String;
begin
  if Enhanced then result:='emf' else result:='wmf';
end;

function TEMFExportFormat.FileFilterIndex: Integer;
begin
  if Enhanced then result:=FFilterIndex else result:=Succ(FFilterIndex);
end;

procedure TEMFExportFormat.IncFileFilterIndex(var FilterIndex: Integer);
begin
  inherited;
  Inc(FilterIndex);
end;

Function TEMFExportFormat.Metafile:TMetafile;
begin
  CheckSize;
  result:=Panel.TeeCreateMetafile(Enhanced,TeeRect(0,0,Width,Height));
end;

Function TEMFExportFormat.Options(Check:Boolean=True):TForm;
begin
  if Check and (not Assigned(FProperties)) then
     FProperties:=TEMFOptions.Create(nil);
  result:=FProperties;
end;

procedure TEMFExportFormat.DoCopyToClipboard;
var tmp : TMetafile;
begin
  tmp:=Metafile;
  try
    Clipboard.Assign(tmp);
  finally
    tmp.Free;
  end;
end;

procedure TEMFExportFormat.SaveToStream(Stream:TStream);
begin
  With Metafile do
  try
    SaveToStream(Stream);
  finally
    Free;
  end;
end;

function TEMFExportFormat.GetEnhanced: Boolean;
begin
  if Assigned(FProperties) then result:=FProperties.CBEnhanced.Checked
                           else result:=True;
end;

procedure TEMFExportFormat.SetEnhanced(const Value: Boolean);
begin
  Options;
  FProperties.CBEnhanced.Checked:=Value;
end;

// Special case only for Metafile export format, that
// supports both "emf" and "wmf" extensions.
function TEMFExportFormat.WantsFilterIndex(Index: Integer): Boolean; // 6.01
begin
  result:=FFilterIndex=Index;
  if (not result) and (Succ(FFilterIndex)=Index) then
  begin
    Enhanced:=False;
    result:=True;
  end;
end;

{ TEMFOptions }

function TEMFExportFormat.GraphicClass: TGraphicClass;
begin
  result:=TMetafile;
end;

initialization
  RegisterTeeExportFormat(TEMFExportFormat);
finalization
  UnRegisterTeeExportFormat(TEMFExportFormat);
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -