程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> GdiPlus[58]: 圖像(十) IGPMetafile 特有的屬性與方法

GdiPlus[58]: 圖像(十) IGPMetafile 特有的屬性與方法

編輯:Delphi

 這包括:

//方法  
IGPMetafile.GetMetafileHeader; { 獲取 Metafile 的 MetafileHeader }  
IGPMetafile.GetHEnhMetafile;  { 獲取增強型 Metafile 的 Windows 句柄 }  
IGPMetafile.PlayRecord();   { 播放單個圖元文件記錄 }  
 
//屬性  
IGPMetafile.DownLevelRasterizationLimit; { 好像是控制紋理畫刷的分辨率用的; 賦於 0 時則使用默認值. }  
 
//還有 
IGPGraphics.AddMetafileComment();   { 向當前 Metafile 添加注釋 } 
IGPGraphics.EnumerateMetafile();   { 枚舉 Metafile 中的圖形命令 } 

  IGPMetafile.GetMetafileHeader 獲取文件信息, 得到一個 TGPMetafileHeader 結構對象:

TGPMetafileHeader.IsWmf;       { 是否是 Wmf 格式 } 
TGPMetafileHeader.IsEmf;       { 是否是 Emf 格式 } 
TGPMetafileHeader.IsEmfPlus;     { 是否是 Emf+ 格式 } 
TGPMetafileHeader.IsEmfOrEmfPlus;  { 是否是 Emf 或 Emf+ 格式 } 
TGPMetafileHeader.IsEmfPlusDual;   { 是否是 "雙重" 增強型圖元文件格式, 它同時支持 Emf 和 Emf+ } 
TGPMetafileHeader.IsWmfPlaceable;  { 能否放置 Wmf } 
TGPMetafileHeader.IsEmfPlusOnly;   { 是否只支持 Emf+ } 
TGPMetafileHeader.IsDisplay;     { 是否與設備相關 } 
 
TGPMetafileHeader.MetafileType;   { 類型 } 
TGPMetafileHeader.MetafileSize;   { 大小; 以字節為單位 } 
TGPMetafileHeader.Version;      { 版本號 } 
TGPMetafileHeader.Bounds;      { 邊界矩形 } 
TGPMetafileHeader.DpiX;       { 水平分辨率; 以每英寸點數為單位 } 
TGPMetafileHeader.DpiY;       { 垂直分辨率; 以每英寸點數為單位 } 
TGPMetafileHeader.LogicalDpiX;    { 邏輯水平分辨率; 以每英寸點數為單位 } 
TGPMetafileHeader.LogicalDpiY;    { 邏輯垂直分辨率; 以每英寸點數為單位 } 
TGPMetafileHeader.EmfPlusFlags;   { Emf+ 標志 } 
TGPMetafileHeader.WmfHeader;     { 獲取 Wmf 文件頭 } 
TGPMetafileHeader.EmfHeader;     { 獲取 Emf 文件頭 } 
TGPMetafileHeader.EmfPlusHeaderSize; { 獲取 EmfHeader 的大小 } 

 簡單顯示(或叫回放)圖元文件:

uses GdiPlus; 
 
procedure TForm1.FormPaint(Sender: TObject); 
var 
 Metafile: IGPMetafile; 
 Graphics: IGPGraphics; 
 Pt: TGPPointF; 
begin 
 Metafile := TGPMetafile.Create('C:\GdiPlusImg\SampleMetafile.emf'); 
 Graphics := TGPGraphics.Create(Handle); 
 Graphics.DrawImage(Metafile, 10, 10); 
end; 

  使用回調函數回放圖元文件之一:

uses GdiPlus; 
 
var Metafile: IGPMetafile; 
 
function MetafileProc(RecordType: TEmfPlusRecordType; Flags, DataSize: UINT; 
 Data: PByte; CallbackData: Pointer): BOOL; stdcall; 
begin 
 Metafile.PlayRecord(RecordType, Flags, DataSize, Data); 
 Result := True; 
end; 
 
procedure TForm1.FormPaint(Sender: TObject); 
var 
// Metafile: IGPMetafile; 
 Graphics: IGPGraphics; 
 Pt: TGPPointF; 
begin 
 Metafile := TGPMetafile.Create('C:\GdiPlusImg\SampleMetafile.emf'); 
 Graphics := TGPGraphics.Create(Handle); 
 Pt.Initialize(10, 10); 
 Graphics.EnumerateMetafile(Metafile, Pt, MetafileProc); 
end; 

  使用回調函數回放圖元文件之二(不使用全局變量):

uses GdiPlus; 
 
function MetafileProc(RecordType: TEmfPlusRecordType; Flags, DataSize: UINT; 
 Data: PByte; CallbackData: Pointer): BOOL; stdcall; 
begin 
 IGPMetafile(CallbackData).PlayRecord(RecordType, Flags, DataSize, Data); 
 Result := True; 
end; 
 
procedure TForm1.FormPaint(Sender: TObject); 
var 
 Metafile: IGPMetafile; 
 Graphics: IGPGraphics; 
 Pt: TGPPointF; 
begin 
 Metafile := TGPMetafile.Create('C:\GdiPlusImg\SampleMetafile.emf'); 
 Graphics := TGPGraphics.Create(Handle); 
 Pt.Initialize(10, 10); 
 Graphics.EnumerateMetafile(Metafile, Pt, MetafileProc, Pointer(Metafile)); 
end; 

獲取圖元文件中命令總數:

uses GdiPlus; 
 
var Metafile: IGPMetafile; 
 
function MetafileProc(RecordType: TEmfPlusRecordType; Flags, DataSize: UINT; 
 Data: PByte; CallbackData: Pointer): BOOL; stdcall; 
begin 
 Inc(PInteger(CallbackData)^); 
 Result := True; 
end; 
 
procedure TForm1.FormPaint(Sender: TObject); 
var 
 Graphics: IGPGraphics; 
 n: Integer; 
begin 
 Metafile := TGPMetafile.Create('C:\GdiPlusImg\SampleMetafile.emf'); 
 Graphics := TGPGraphics.Create(Handle); 
 n := 0; 
 Graphics.EnumerateMetafile(Metafile, TGPPointF.Create(10,10), MetafileProc, @n); 
 Text := IntToStr(n); { 13 } 
end; 

  獲取圖元文件的命令類型列表:

uses GdiPlus; 
 
var 
 Metafile: IGPMetafile; 
 List: TStrings; 
 
procedure TForm1.FormCreate(Sender: TObject); 
begin 
 List := TStringList.Create; 
 List.CommaText := 
  '66058=WmfRecordTypeSetTextJustification,'+ 
  '66059=WmfRecordTypeSetWindowOrg,'+ 
  '66060=WmfRecordTypeSetWindowExt,'+ 
  '66061=WmfRecordTypeSetVIEwportOrg,'+ 
  '66062=WmfRecordTypeSetVIEwportExt,'+ 
  '66063=WmfRecordTypeOffsetWindowOrg,'+ 
  '66576=WmfRecordTypeScaleWindowExt,'+ 
  '66065=WmfRecordTypeOffsetVIEwportOrg,'+ 
  '66578=WmfRecordTypeScaleVIEwportExt,'+ 
  '66067=WmfRecordTypeLineTo,'+ 
  '66068=WmfRecordTypeMoveTo,'+ 
  '66581=WmfRecordTypeExcludeClipRect,'+ 
  '66582=WmfRecordTypeIntersectClipRect,'+ 
  '67607=WmfRecordTypeArc,'+ 
  '66584=WmfRecordTypeEllipse,'+ 
  '66585=WmfRecordTypeFloodFill,'+ 
  '67610=WmfRecordTypePIE,'+ 
  '66587=WmfRecordTypeRectangle,'+ 
  '67100=WmfRecordTypeRoundRect,'+ 
  '67101=WmfRecordTypePatBlt,'+ 
  '65566=WmfRecordTypeSaveDC,'+ 
  '66591=WmfRecordTypeSetPixel,'+ 
  '66080=WmfRecordTypeOffsetClipRgn,'+ 
  '66849=WmfRecordTypeTextOut,'+ 
  '67874=WmfRecordTypeBitBlt,'+ 
  '68387=WmfRecordTypeStretchBlt,'+ 
  '66340=WmfRecordTypePolygon,'+ 
  '66341=WmfRecordTypePolyline,'+ 
  '67110=WmfRecordTypeEscape,'+ 
  '65831=WmfRecordTypeRestoreDC,'+ 
  '66088=WmfRecordTypeFillRegion,'+ 
  '66601=WmfRecordTypeFrameRegion,'+ 
  '65834=WmfRecordTypeInvertRegion,'+ 
  '65835=WmfRecordTypePaintRegion,'+ 
  '65836=WmfRecordTypeSelectClipRegion,'+ 
  '65837=WmfRecordTypeSelectObject,'+ 
  '65838=WmfRecordTypeSetTextAlign,'+ 
  '67119=WmfRecordTypeDrawText,'+ 
  '67632=WmfRecordTypeChord,'+ 
  '66097=WmfRecordTypeSetMapperFlags,'+ 
  '68146=WmfRecordTypeExtTextOut,'+ 
  '68915=WmfRecordTypeSetDIBToDev,'+ 
  '66100=WmfRecordTypeSelectPalette,'+ 
  '65589=WmfRecordTypeRealizePalette,'+ 
  '66614=WmfRecordTypeAnimatePalette,'+ 
  '65591=WmfRecordTypeSetPalEntrIEs,'+ 
  '66872=WmfRecordTypePolyPolygon,'+ 
  '65849=WmfRecordTypeResizePalette,'+ 
  '67904=WmfRecordTypeDIBBitBlt,'+ 
  '68417=WmfRecordTypeDIBStretchBlt,'+ 
  '65858=WmfRecordTypeDIBCreatePatternBrush,'+ 
  '69443=WmfRecordTypeStretchDIB,'+ 
  '66888=WmfRecordTypeExtFloodFill,'+ 
  '65865=WmfRecordTypeSetLayout,'+ 
  '65868=WmfRecordTypeResetDC,'+ 
  '65869=WmfRecordTypeStartDoc,'+ 
  '65615=WmfRecordTypeStartPage,'+ 
  '65616=WmfRecordTypeEndPage,'+ 
  '65618=WmfRecordTypeAbortDoc,'+ 
  '65630=WmfRecordTypeEndDoc,'+ 
  '66032=WmfRecordTypeDeleteObject,'+ 
  '65783=WmfRecordTypeCreatePalette,'+ 
  '65784=WmfRecordTypeCreateBrush,'+ 
  '66041=WmfRecordTypeCreatePatternBrush,'+ 
  '66298=WmfRecordTypeCreatePenIndirect,'+ 
  '66299=WmfRecordTypeCreateFontIndirect,'+ 
  '66300=WmfRecordTypeCreateBrushIndirect,'+ 
  '66301=WmfRecordTypeCreateBitmapIndirect,'+ 
  '67326=WmfRecordTypeCreateBitmap,'+ 
  '67327=WmfRecordTypeCreateRegion,'+ 
  '1=EmfRecordTypeHeader,'+ 
  '2=EmfRecordTypePolyBezIEr,'+ 
  '3=EmfRecordTypePolygon,'+ 
  '4=EmfRecordTypePolyline,'+ 
  '5=EmfRecordTypePolyBezIErTo,'+ 
  '6=EmfRecordTypePolyLineTo,'+ 
  '7=EmfRecordTypePolyPolyline,'+ 
  '8=EmfRecordTypePolyPolygon,'+ 
  '9=EmfRecordTypeSetWindowExtEx,'+ 
  '10=EmfRecordTypeSetWindowOrgEx,'+ 
  '11=EmfRecordTypeSetVIEwportExtEx,'+ 
  '12=EmfRecordTypeSetVIEwportOrgEx,'+ 
  '13=EmfRecordTypeSetBrushOrgEx,'+ 
  '14=EmfRecordTypeEOF,'+ 
  '15=EmfRecordTypeSetPixelV,'+ 
  '16=EmfRecordTypeSetMapperFlags,'+ 
  '17=EmfRecordTypeSetMapMode,'+ 
  '18=EmfRecordTypeSetBkMode,'+ 
  '19=EmfRecordTypeSetPolyFillMode,'+ 
  '20=EmfRecordTypeSetROP2,'+ 
  '21=EmfRecordTypeSetStretchBltMode,'+ 
  '22=EmfRecordTypeSetTextAlign,'+ 
  '23=EmfRecordTypeSetColorAdjustment,'+ 
  '24=EmfRecordTypeSetTextColor,'+ 
  '25=EmfRecordTypeSetBkColor,'+ 
  '26=EmfRecordTypeOffsetClipRgn,'+ 
  '27=EmfRecordTypeMoveToEx,'+ 
  '28=EmfRecordTypeSetMetaRgn,'+ 
  '29=EmfRecordTypeExcludeClipRect,'+ 
  '30=EmfRecordTypeIntersectClipRect,'+ 
  '31=EmfRecordTypeScaleVIEwportExtEx,'+ 
  '32=EmfRecordTypeScaleWindowExtEx,'+ 
  '33=EmfRecordTypeSaveDC,'+ 
  '34=EmfRecordTypeRestoreDC,'+ 
  '35=EmfRecordTypeSetWorldTransform,'+ 
  '36=EmfRecordTypeModifyWorldTransform,'+ 
  '37=EmfRecordTypeSelectObject,'+ 
  '38=EmfRecordTypeCreatePen,'+ 
  '39=EmfRecordTypeCreateBrushIndirect,'+ 
  '40=EmfRecordTypeDeleteObject,'+ 
  '41=EmfRecordTypeAngleArc,'+ 
  '42=EmfRecordTypeEllipse,'+ 
  '43=EmfRecordTypeRectangle,'+ 
  '44=EmfRecordTypeRoundRect,'+ 
  '45=EmfRecordTypeArc,'+ 
  '46=EmfRecordTypeChord,'+ 
  '47=EmfRecordTypePIE,'+ 
  '48=EmfRecordTypeSelectPalette,'+ 
  '49=EmfRecordTypeCreatePalette,'+ 
  '50=EmfRecordTypeSetPaletteEntrIEs,'+ 
  '51=EmfRecordTypeResizePalette,'+ 
  '52=EmfRecordTypeRealizePalette,'+ 
  '53=EmfRecordTypeExtFloodFill,'+ 
  '54=EmfRecordTypeLineTo,'+ 
  '55=EmfRecordTypeArcTo,'+ 
  '56=EmfRecordTypePolyDraw,'+ 
  '57=EmfRecordTypeSetArcDirection,'+ 
  '58=EmfRecordTypeSetMiterLimit,'+ 
  '59=EmfRecordTypeBeginPath,'+ 
  '60=EmfRecordTypeEndPath,'+ 
  '61=EmfRecordTypeCloseFigure,'+ 
  '62=EmfRecordTypeFillPath,'+ 
  '63=EmfRecordTypeStrokeAndFillPath,'+ 
  '64=EmfRecordTypeStrokePath,'+ 
  '65=EmfRecordTypeFlattenPath,'+ 
  '66=EmfRecordTypeWidenPath,'+ 
  '67=EmfRecordTypeSelectClipPath,'+ 
  '68=EmfRecordTypeAbortPath,'+ 
  '69=EmfRecordTypeReserved_069,'+ 
  '70=EmfRecordTypeGdiComment,'+ 
  '71=EmfRecordTypeFillRgn,'+ 
  '72=EmfRecordTypeFrameRgn,'+ 
  '73=EmfRecordTypeInvertRgn,'+ 
  '74=EmfRecordTypePaintRgn,'+ 
  '75=EmfRecordTypeExtSelectClipRgn,'+ 
  '76=EmfRecordTypeBitBlt,'+ 
  '77=EmfRecordTypeStretchBlt,'+ 
  '78=EmfRecordTypeMaskBlt,'+ 
  '79=EmfRecordTypePlgBlt,'+ 
  '80=EmfRecordTypeSetDIBitsToDevice,'+ 
  '81=EmfRecordTypeStretchDIBits,'+ 
  '82=EmfRecordTypeExtCreateFontIndirect,'+ 
  '83=EmfRecordTypeExtTextOutA,'+ 
  '84=EmfRecordTypeExtTextOutW,'+ 
  '85=EmfRecordTypePolyBezIEr16,'+ 
  '86=EmfRecordTypePolygon16,'+ 
  '87=EmfRecordTypePolyline16,'+ 
  '88=EmfRecordTypePolyBezIErTo16,'+ 
  '89=EmfRecordTypePolylineTo16,'+ 
  '90=EmfRecordTypePolyPolyline16,'+ 
  '91=EmfRecordTypePolyPolygon16,'+ 
  '92=EmfRecordTypePolyDraw16,'+ 
  '93=EmfRecordTypeCreateMonoBrush,'+ 
  '94=EmfRecordTypeCreateDIBPatternBrushPt,'+ 
  '95=EmfRecordTypeExtCreatePen,'+ 
  '96=EmfRecordTypePolyTextOutA,'+ 
  '97=EmfRecordTypePolyTextOutW,'+ 
  '98=EmfRecordTypeSetICMMode,'+ 
  '99=EmfRecordTypeCreateColorSpace,'+ 
  '100=EmfRecordTypeSetColorSpace,'+ 
  '101=EmfRecordTypeDeleteColorSpace,'+ 
  '102=EmfRecordTypeGLSRecord,'+ 
  '103=EmfRecordTypeGLSBoundedRecord,'+ 
  '104=EmfRecordTypePixelFormat,'+ 
  '105=EmfRecordTypeDrawEscape,'+ 
  '106=EmfRecordTypeExtEscape,'+ 
  '107=EmfRecordTypeStartDoc,'+ 
  '108=EmfRecordTypeSmallTextOut,'+ 
  '109=EmfRecordTypeForceUFIMapping,'+ 
  '110=EmfRecordTypeNamedEscape,'+ 
  '111=EmfRecordTypeColorCorrectPalette,'+ 
  '112=EmfRecordTypeSetICMProfileA,'+ 
  '113=EmfRecordTypeSetICMProfileW,'+ 
  '114=EmfRecordTypeAlphaBlend,'+ 
  '115=EmfRecordTypeSetLayout,'+ 
  '116=EmfRecordTypeTransparentBlt,'+ 
  '117=EmfRecordTypeReserved_117,'+ 
  '118=EmfRecordTypeGradIEntFill,'+ 
  '119=EmfRecordTypeSetLinkedUFIs,'+ 
  '120=EmfRecordTypeSetTextJustification,'+ 
  '121=EmfRecordTypeColorMatchToTargetW,'+ 
  '122=EmfRecordTypeCreateColorSpaceW,'+ 
  '16384=EmfPlusRecordTypeInvalid,'+ 
  '16385=EmfPlusRecordTypeHeader,'+ 
  '16386=EmfPlusRecordTypeEndOfFile,'+ 
  '16387=EmfPlusRecordTypeComment,'+ 
  '16388=EmfPlusRecordTypeGetDC,'+ 
  '16389=EmfPlusRecordTypeMultiFormatStart,'+ 
  '16390=EmfPlusRecordTypeMultiFormatSection,'+ 
  '16391=EmfPlusRecordTypeMultiFormatEnd,'+ 
  '16392=EmfPlusRecordTypeObject,'+ 
  '16393=EmfPlusRecordTypeClear,'+ 
  '16394=EmfPlusRecordTypeFillRects,'+ 
  '16395=EmfPlusRecordTypeDrawRects,'+ 
  '16396=EmfPlusRecordTypeFillPolygon,'+ 
  '16397=EmfPlusRecordTypeDrawLines,'+ 
  '16398=EmfPlusRecordTypeFillEllipse,'+ 
  '16399=EmfPlusRecordTypeDrawEllipse,'+ 
  '16400=EmfPlusRecordTypeFillPIE,'+ 
  '16401=EmfPlusRecordTypeDrawPIE,'+ 
  '16402=EmfPlusRecordTypeDrawArc,'+ 
  '16403=EmfPlusRecordTypeFillRegion,'+ 
  '16404=EmfPlusRecordTypeFillPath,'+ 
  '16405=EmfPlusRecordTypeDrawPath,'+ 
  '16406=EmfPlusRecordTypeFillClosedCurve,'+ 
  '16407=EmfPlusRecordTypeDrawClosedCurve,'+ 
  '16408=EmfPlusRecordTypeDrawCurve,'+ 
  '16409=EmfPlusRecordTypeDrawBezIErs,'+ 
  '16410=EmfPlusRecordTypeDrawImage,'+ 
  '16411=EmfPlusRecordTypeDrawImagePoints,'+ 
  '16412=EmfPlusRecordTypeDrawString,'+ 
  '16413=EmfPlusRecordTypeSetRenderingOrigin,'+ 
  '16414=EmfPlusRecordTypeSetAntiAliasMode,'+ 
  '16415=EmfPlusRecordTypeSetTextRenderingHint,'+ 
  '16416=EmfPlusRecordTypeSetTextContrast,'+ 
  '16417=EmfPlusRecordTypeSetInterpolationMode,'+ 
  '16418=EmfPlusRecordTypeSetPixelOffsetMode,'+ 
  '16419=EmfPlusRecordTypeSetCompositingMode,'+ 
  '16420=EmfPlusRecordTypeSetCompositingQuality,'+ 
  '16421=EmfPlusRecordTypeSave,'+ 
  '16422=EmfPlusRecordTypeRestore,'+ 
  '16423=EmfPlusRecordTypeBeginContainer,'+ 
  '16424=EmfPlusRecordTypeBeginContainerNoParams,'+ 
  '16425=EmfPlusRecordTypeEndContainer,'+ 
  '16426=EmfPlusRecordTypeSetWorldTransform,'+ 
  '16427=EmfPlusRecordTypeResetWorldTransform,'+ 
  '16428=EmfPlusRecordTypeMultiplyWorldTransform,'+ 
  '16429=EmfPlusRecordTypeTranslateWorldTransform,'+ 
  '16430=EmfPlusRecordTypeScaleWorldTransform,'+ 
  '16431=EmfPlusRecordTypeRotateWorldTransform,'+ 
  '16432=EmfPlusRecordTypeSetPageTransform,'+ 
  '16433=EmfPlusRecordTypeResetClip,'+ 
  '16434=EmfPlusRecordTypeSetClipRect,'+ 
  '16435=EmfPlusRecordTypeSetClipPath,'+ 
  '16436=EmfPlusRecordTypeSetClipRegion,'+ 
  '16437=EmfPlusRecordTypeOffsetClip,'+ 
  '16438=EmfPlusRecordTypeDrawDriverString,'+ 
  '16439=EmfPlusRecordTypeStrokeFillPath,'+ 
  '16440=EmfPlusRecordTypeSerializableObject,'+ 
  '16441=EmfPlusRecordTypeSetTSGraphics,'+ 
  '16442=EmfPlusRecordTypeSetTSClip'; 
end; 
 
function MetafileProc(RecordType: TEmfPlusRecordType; Flags, DataSize: UINT; 
 Data: PByte; CallbackData: Pointer): BOOL; stdcall; 
begin 
 PString(CallbackData)^ := PString(CallbackData)^ + List.Values[IntToStr(Ord(RecordType))] + #13#10; 
 Result := True; 
end; 
 
procedure TForm1.FormPaint(Sender: TObject); 
var 
 Graphics: IGPGraphics; 
 str: string; 
begin 
 Metafile := TGPMetafile.Create('C:\GdiPlusImg\SampleMetafile.emf'); 
 Graphics := TGPGraphics.Create(Handle); 
 Graphics.EnumerateMetafile(Metafile, TGPPointF.Create(10,10), MetafileProc, @str); 
 ShowMessage(str); 
{ 結果: 
 EmfRecordTypeHeader 
 EmfPlusRecordTypeHeader 
 EmfPlusRecordTypeObject 
 EmfPlusRecordTypeDrawRects 
 EmfPlusRecordTypeDrawEllipse 
 EmfPlusRecordTypeSetAntiAliasMode 
 EmfPlusRecordTypeDrawEllipse 
 EmfPlusRecordTypeSetTextRenderingHint 
 EmfPlusRecordTypeRotateWorldTransform 
 EmfPlusRecordTypeObject 
 EmfPlusRecordTypeDrawString 
 EmfPlusRecordTypeEndOfFile 
 EmfRecordTypeEOF 
} 
end; 
 
procedure TForm1.FormDestroy(Sender: TObject); 
begin 
 List.Free; 
end; 

  不回放其中的橢圓:

uses GdiPlus; 
 
var Metafile: IGPMetafile; 
 
function MetafileProc(RecordType: TEmfPlusRecordType; Flags, DataSize: UINT; 
 Data: PByte; CallbackData: Pointer): BOOL; stdcall; 
begin 
 if RecordType <> EmfPlusRecordTypeDrawrEllipse then 
 begin 
  Metafile.PlayRecord(RecordType, Flags, DataSize, Data); 
 end; 
 Result := True; 
end; 
 
procedure TForm1.FormPaint(Sender: TObject); 
var 
 Graphics: IGPGraphics; 
begin 
 Metafile := TGPMetafile.Create('C:\GdiPlusImg\SampleMetafile.emf'); 
 Graphics := TGPGraphics.Create(Handle); 
 Graphics.EnumerateMetafile(Metafile, TGPPointF.Create(10, 10), MetafileProc); 
end; 




  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved