File: wx145.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (86 lines) | stat: -rw-r--r-- 3,054 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<HTML>
<head><title>wxMetafile</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxmetafile"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx144.htm#wxmessagedialog"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx146.htm#wxmetafiledc"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxMetafile</H2>
<P>
A <B>wxMetafile</B> represents the MS Windows metafile object, so metafile
operations have no effect in X. In wxWindows, only sufficient functionality
has been provided for copying a graphic to the clipboard; this may be extended
in a future version. Presently, the only way of creating a metafile
is to use a wxMetafileDC.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/metafile.h&gt;<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx146.htm#wxmetafiledc">wxMetafileDC</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic565">wxMetafile::wxMetafile</A><BR>
<A HREF="#topic566">wxMetafile::~wxMetafile</A><BR>
<A HREF="#wxmetafileok">wxMetafile::Ok</A><BR>
<A HREF="#wxmetafileplay">wxMetafile::Play</A><BR>
<A HREF="#topic567">wxMetafile::SetClipboard</A><BR>
<P>

<HR>
<A NAME="topic565"></A>
<H3>wxMetafile::wxMetafile</H3>
<P>
<B></B> <B>wxMetafile</B>(<B>const wxString&amp; </B><I>filename = ""</I>)<P>
Constructor. If a filename is given, the Windows disk metafile is
read in. Check whether this was performed successfully by
using the <A HREF="wx145.htm#wxmetafileok">wxMetafile::Ok</A> member.<P>

<HR>
<A NAME="topic566"></A>
<H3>wxMetafile::~wxMetafile</H3>
<P>
<B></B> <B>~wxMetafile</B>()<P>
Destructor.<P>

<HR>
<A NAME="wxmetafileok"></A>
<H3>wxMetafile::Ok</H3>
<P>
<B>bool</B> <B>Ok</B>()<P>
Returns TRUE if the metafile is valid.<P>

<HR>
<A NAME="wxmetafileplay"></A>
<H3>wxMetafile::Play</H3>
<P>
<B>bool</B> <B>Play</B>(<B>wxDC *</B><I>dc</I>)<P>
Plays the metafile into the given device context, returning
TRUE if successful.<P>

<HR>
<A NAME="topic567"></A>
<H3>wxMetafile::SetClipboard</H3>
<P>
<B>bool</B> <B>SetClipboard</B>(<B>int</B><I> width = 0</I>, <B>int</B><I> height = 0</I>)<P>
Passes the metafile data to the clipboard. The metafile can no longer be
used for anything, but the wxMetafile object must still be destroyed by
the application.<P>
Below is a example of metafle, metafile device context and clipboard use
from the <TT>hello.cpp</TT> example. Note the way the metafile dimensions
are passed to the clipboard, making use of the device context's ability
to keep track of the maximum extent of drawing commands.<P>
<PRE>
  wxMetafileDC dc;
  if (dc.Ok())
  {
    Draw(dc, FALSE);
    wxMetafile *mf = dc.Close();
    if (mf)
    {
      bool success = mf-&gt;SetClipboard((int)(dc.MaxX() + 10), (int)(dc.MaxY() + 10));
      delete mf;
    }
  }
</PRE>

</BODY></HTML>