跳楼价(几天没解决,有高手吗?真失败) (300分)

  • 主题发起人 主题发起人 zbxx631
  • 开始时间 开始时间
Z

zbxx631

Unregistered / Unconfirmed
GUEST, unregistred user!
那位大侠知道如下函数在DELPHI中如何使用,请给出例子,谢谢。<br>CloseEnhMetaFile<br>CopyEnhMetaFile<br>CreateEnhMetaFile<br>DeleteEnhMetaFile<br>EnhMetaFileProc<br>EnumEnhMetaFile<br>GdiComment<br>GetEnhMetaFile<br>GetEnhMetaFileBits<br>GetEnhMetaFileDescription<br>GetEnhMetaFileHeader<br>GetEnhMetaFilePaletteEntries<br>GetWinMetaFileBits<br>PlayEnhMetaFile<br>PlayEnhMetaFileRecord<br>SetEnhMetaFileBits<br>SetWinMetaFileBits
 
不是有帮助吗?
 
要使用的例子。
 
给出其中的几个主要函数也可以
 
呵呵,帮助中都可以找到,下面:<br>The GetEnhMetaFilePaletteEntries function retrieves optional palette entries from the specified enhanced metafile. <br><br>UINT GetEnhMetaFilePaletteEntries(<br><br>&nbsp; &nbsp; HENHMETAFILE hemf, // handle of enhanced metafile <br>&nbsp; &nbsp; UINT cEntries, // count of palette entries <br>&nbsp; &nbsp; LPPALETTEENTRY lppe // address of palette-entry array &nbsp;<br>&nbsp; &nbsp;); <br>&nbsp;<br><br>Parameters<br><br>hemf<br><br>Identifies the enhanced metafile. <br><br>cEntries<br><br>Specifies the number of entries to be retrieved from the optional palette. <br><br>lppe<br><br>Points to an array of PALETTEENTRY structures to receive the palette colors. The array must contain at least as many structures as there are entries specified by the cEntries parameter.<br><br>&nbsp;<br><br>Return Values<br><br>If the array pointer is NULL and the enhanced metafile contains an optional palette, the return value is the number of entries in the enhanced metafile's palette; if the array pointer is a valid pointer and the enhanced metafile contains an optional palette, the return value is the number of entries copied; if the metafile does not contain an optional palette, the return value is zero. Otherwise, the return value is GDI_ERROR.
 
那些只是参数说明,不是例子,并且其中几个函数的调用的有关联性的。<br>我的目的是要显示元文件中满足条件的那部分图象显示出来,<br>例如打印时只打印第几页,就只取出第几页的图象打印出来。
 
查一下HELP
 
自己写的打印,然后保存到元文件中,然后根据条件部分或全部<br>显示到显示器或打印机上,
 
在线帮助,找不到吗?
 
我写了这样一段代码,想把元文件的内容显示在窗体上,运行没有任何反应,是什么原故?<br>var<br>&nbsp; hdcEMF,hemf,dhc:Word;<br>&nbsp; rec:TRect ;<br>&nbsp; aa:Word;<br>&nbsp; ps:PAINTSTRUCT;<br>begin<br>&nbsp; rec.Left :=0;<br>&nbsp; Rec.Top :=0;<br>&nbsp; rec.Right :=Self.Height ;<br>&nbsp; rec.Bottom :=self.Width ;<br>&nbsp; hdcEMF:=CreateEnhMetaFile(0,Nil,Nil, Nil);<br>&nbsp; LineTo(hdcEMF,10,20);<br>&nbsp; LineTo(hdcEMF,200,110);<br>&nbsp; hemf:=CloseEnhMetaFile (hdcEMF) ;<br>&nbsp; dhc:=BeginPaint(self.Handle,ps);<br>&nbsp; PlayEnhMetaFile (dhc , hemf, rec) ;<br>&nbsp; DeleteEnhMetaFile(hemf);<br>&nbsp; EndPaint (self.Handle, ps) ;<br>end;
 
老大,你连MetaCanvas都没建,怎么能写得上去啊?<br>var<br>&nbsp; mtf: TMetaFile;<br>&nbsp; mtv: TMetaFileCanvas;<br>begin<br>&nbsp; mtf := TMetaFile.Create;<br>&nbsp; mtf.Height := 120;<br>&nbsp; mtf.Width := 200;<br>&nbsp; mtv := TMetaFileCanvas.Create(mtf, 0);<br>&nbsp; mtv.Pen....<br>&nbsp; mtv.MoveTo(10,20);<br>&nbsp; mtv.LineTo(100,100);<br>&nbsp; mtv....<br>&nbsp; ...<br>&nbsp; mtv.Free;<br>&nbsp; Canvas.Draw(50, 50, mtf);<br>
 
TO kisber:<br>我想对元文件中的元素进行控制,<br>TMetaFile只能对整个元文件控制,不能访问元文件中的单个画图元素<br>谢谢
 
sorry,表错情!
 
看看这段程序对你是否有帮助<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>{these hold important screen dimension information used when creating the reference rectangle}<br>WidthInMM,<br>HeightInMM,<br>WidthInPixels,<br>HeightInPixels: Integer;<br>{holds millimeter per pixel ratios}<br>MMPerPixelHorz,<br>MMPerPixelVer: Integer;<br>{the reference rectangle}<br>ReferenceRect: TRect;<br>{a handle to the metafile device context}<br>MetafileDC: HDC;<br>{the handle to a metafile}<br>TheMetafile: HENHMETAFILE;<br>{a handle to a brush used in drawing on the metafile}<br>TheBrush: HBRUSH;<br>OldBrush: HBRUSH;<br>begin<br>{the CreateEnhMetaFile function assumes that the dimensions in the reference<br>rectangle are in terms of .01 millimeter units (i.e., a 1 equals .01<br>millimeters, 2 equals .02 millimeters, etc.). therefore, the following<br>lines are required to obtain a millimeters per pixel ratio. this can then<br>be used to create a reference rectangle with the appropriate dimensions.}<br>{retrieve the size of the screen in millimeters}<br>WidthInMM:=GetDeviceCaps(Form1.Canvas.Handle, HORZSIZE);<br>HeightInMM:=GetDeviceCaps(Form1.Canvas.Handle, VERTSIZE);<br>{retrieve the size of the screen in pixels}<br>WidthInPixels:=GetDeviceCaps(Form1.Canvas.Handle, HORZRES);<br>HeightInPixels:=GetDeviceCaps(Form1.Canvas.Handle, VERTRES);<br>{compute a millimeter per pixel ratio. the millimeter measurements must be<br>multiplied by 100 to get the appropriate unit measurement that the<br>CreateEnhMetaFile is expecting (where a 1 equals .01 millimeters)}<br>MMPerPixelHorz:=(WidthInMM * 100) div WidthInPixels;<br>MMPerPixelVer:=(HeightInMM * 100) div HeightInPixels;<br>{create our reference rectangle for the metafile}<br>ReferenceRect.Top:=0;<br>ReferenceRect.Left:=0;<br>ReferenceRect.Right:=Image1.Width * MMPerPixelHorz;<br>ReferenceRect.Bottom:=Image1.Height * MMPerPixelVer;<br>{create a metafile that will be saved to disk}<br>MetafileDC:=CreateEnhMetaFile(Form1.Canvas.Handle, 'Example.emf',<br>@ReferenceRect,<br>'CreateEnhMetaFile Example Program'+Chr(0)+<br>'Example Metafile'+Chr(0)+Chr(0));<br>{display some text in the metafile}<br>TextOut(MetafileDC,15,15,'This is an enhanced metafile.',29);<br>{create a diagonal hatched brush and select it into the metafile}<br>TheBrush:=CreateHatchBrush(HS_DIAGCROSS, clRed);<br>OldBrush:=SelectObject(MetafileDC, TheBrush);<br>{draw a filled rectangle}<br>Rectangle(MetafileDC, 15, 50, 250, 250);<br>{delete the current brush}<br>SelectObject(MetafileDC, OldBrush);<br>DeleteObject(TheBrush);<br>{create a horizontal hatched brush and select it into the metafile}<br>TheBrush:=CreateHatchBrush(HS_CROSS, clBlue);<br>OldBrush:=SelectObject(MetafileDC, TheBrush);<br>{draw a filled ellipse}<br>Ellipse(MetafileDC, 15, 50, 250, 250);<br>{delete the current brush}<br>SelectObject(MetafileDC, OldBrush);<br>DeleteObject(TheBrush);<br>{close the metafile, saving it to disk and retrieving a handle}<br>TheMetafile:=CloseEnhMetaFile(MetafileDC);<br>{draw the metafile into the Image1 canvas}<br>PlayEnhMetaFile(Image1.Canvas.Handle, TheMetafile, Image1.Canvas.Cliprect);<br>{we are done with the metafile, so delete its handle}<br>DeleteEnhMetaFile(TheMetafile);<br>end;<br>end.<br>
 
我研究一下先,thanks
 
接受答案了.
 
后退
顶部