public Metafile(IntPtr referenceHdc, EmfType emfType, string description)
 {
     System.Drawing.IntSecurity.ObjectFromWin32Handle.Demand();
     IntPtr zero = IntPtr.Zero;
     int status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc), (int) emfType, System.Drawing.NativeMethods.NullHandleRef, 7, description, out zero);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     base.SetNativeImage(zero);
 }
Ejemplo n.º 2
0
		private void CreateInternalMetafile(EmfType type)
		{
			//Create a temporary bitmap to get an HDC
			Graphics graphics = Component.Instance.CreateGraphics();
			IntPtr hDC = graphics.GetHdc();

			//Create metafile based on type and get graphics handle
			mMetafile = new System.Drawing.Imaging.Metafile(hDC, type);
			graphics.ReleaseHdc(hDC);

			graphics.Dispose();
		}
        public static Metafile CreateMetafile(
            this BitmapSource bitmap, 
            double horizontalScale = 1.0,
            double verticalScale = 1.0,
            EmfType emf = EmfType.EmfOnly,
            SmoothingMode smoothingMode = SmoothingMode.HighQuality,
            InterpolationMode interpolationMode = InterpolationMode.HighQualityBicubic,
            PixelOffsetMode pixelOffsetMode = PixelOffsetMode.HighQuality,
            CompositingQuality compositingQuality = CompositingQuality.HighQuality)
        {
            var mf = (Metafile)null;

            using (System.Drawing.Graphics cx = System.Drawing.Graphics.FromHwndInternal(IntPtr.Zero))
            {
                mf = new Metafile(new MemoryStream(), cx.GetHdc(), emf);

                using (var g = System.Drawing.Graphics.FromImage(mf))
                {
                    var img = bitmap.ToBitmap();

                    g.SmoothingMode = smoothingMode;
                    g.InterpolationMode = interpolationMode;
                    g.PixelOffsetMode = pixelOffsetMode;
                    g.CompositingQuality = compositingQuality;

                    var rect =
                        new System.Drawing.RectangleF(
                            0,
                            0,
                            img.PhysicalDimension.Width * (float)horizontalScale,
                            img.PhysicalDimension.Height * (float)verticalScale);

                    g.DrawImage(img, rect);
                }
            }

            return mf;
        }
Ejemplo n.º 4
0
 public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
                 EmfType type) : this(stream, referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Ejemplo n.º 5
0
		public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
			EmfType type) : this (fileName, referenceHdc, frameRect, frameUnit, type, null)
		{
		}
Ejemplo n.º 6
0
	public Metafile(Stream stream, IntPtr referenceHdc, EmfType type)
			: this(stream, referenceHdc, type, null) {}
Ejemplo n.º 7
0
		public Metafile (IntPtr referenceHdc, EmfType emfType) :
			this (referenceHdc, new RectangleF (), MetafileFrameUnit.GdiCompatible, emfType, null)
		{
		}
Ejemplo n.º 8
0
        public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit,
                        EmfType type, string description)
        {
            IntSecurity.ObjectFromWin32Handle.Demand();

            IntPtr metafile = IntPtr.Zero;

            int status;

            if (frameRect.IsEmpty) {
                status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), 
                                                          new HandleRef(null, referenceHdc), 
                                                          unchecked((int)type),
                                                          NativeMethods.NullHandleRef, 
                                                          unchecked((int)frameUnit), 
                                                          description, 
                                                          out metafile);
            }
            else {
                GPRECT gprect = new GPRECT(frameRect);
                status = SafeNativeMethods.Gdip.GdipRecordMetafileStreamI(new GPStream(stream), 
                                                           new HandleRef(null, referenceHdc), 
                                                           unchecked((int)type),
                                                           ref gprect, 
                                                           unchecked((int)frameUnit), 
                                                           description, 
                                                           out metafile);
            }

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeImage(metafile);
        }
Ejemplo n.º 9
0
		internal static extern Status GdipRecordMetafileStreamI ([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, IntPtr hdc, 
			EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
	public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, EmfType type) {}
	public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, EmfType type, string description) {}
Ejemplo n.º 12
0
 public Metafile(Stream stream, IntPtr referenceHdc,
                 EmfType type, string description)
 {
     // TODO
 }
Ejemplo n.º 13
0
 public Metafile(Stream stream, IntPtr referenceHdc,
                 Rectangle frameRect, MetafileFrameUnit frameUnit,
                 EmfType type, string description)
 {
     // TODO
 }
Ejemplo n.º 14
0
 public Metafile(string fileName, IntPtr referenceHdc,
                 EmfType type, string description)
 {
     // TODO
 }
Ejemplo n.º 15
0
 public Metafile(IntPtr referenceHtc, EmfType emfType)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 16
0
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type,
                 string description)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 17
0
 public Metafile(IntPtr referenceHdc, EmfType emfType) :
     this(referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, emfType, null)
 {
 }
	public Metafile(System.IO.Stream stream, System.IntPtr referenceHdc, System.Drawing.Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) {}
Ejemplo n.º 19
0
        public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect,
                        MetafileFrameUnit frameUnit, EmfType type, String description)
        {
            IntSecurity.DemandReadFileIO(fileName);
            IntSecurity.ObjectFromWin32Handle.Demand();

            IntPtr metafile = IntPtr.Zero;

            GPRECTF rectf = new GPRECTF(frameRect);
            int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, 
                                                            new HandleRef(null, referenceHdc), 
                                                            unchecked((int)type), 
                                                            ref rectf,
                                                            unchecked((int)frameUnit), 
                                                            description, 
                                                            out metafile);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeImage(metafile);
        }
	public Metafile(System.IntPtr referenceHdc, EmfType emfType) {}
Ejemplo n.º 21
0
 public Metafile(IntPtr referenceHdc, EmfType emfType) :
     this(referenceHdc, emfType, null)
 {
 }
Ejemplo n.º 22
0
        public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type,
                        string desc)
        {
            int status = SafeNativeMethods.Gdip.GdipRecordMetafileI(referenceHdc, type, ref frameRect, frameUnit,
                                                                    desc, out nativeImage);

            SafeNativeMethods.Gdip.CheckStatus(status);
        }
Ejemplo n.º 23
0
		private void RecordFileName (IntPtr hdc, EmfType type, MetafileFrameUnit unit)
		{
			string filename = String.Format ("test-{0}-{1}.emf", type, unit);
			IntPtr metafile;
			RectangleF rect = new RectangleF (10, 20, 100, 200);
			Status status = GDIPlus.GdipRecordMetafileFileName (filename, hdc, type, ref rect, unit, filename, out metafile);
			if (metafile != IntPtr.Zero)
				GDIPlus.GdipDisposeImage (metafile);
			if (status == Status.Ok)
				File.Delete (filename);
			Assert.AreEqual (Status.Ok, status, filename);
		}
Ejemplo n.º 24
0
 public Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string description) :
     this(stream, referenceHdc, default(RectangleF), MetafileFrameUnit.GdiCompatible, type, description)
 {
 }
Ejemplo n.º 25
0
	public Metafile(String fileName, IntPtr referenceHdc,
					EmfType type, String description)
			{
				// TODO
			}
Ejemplo n.º 26
0
        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class from the specified device context, bounded
        /// by the specified rectangle.
        /// </summary>
        public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string desc)
        {
            IntPtr metafile = IntPtr.Zero;

            if (frameRect.IsEmpty)
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafile(
                                     new HandleRef(null, referenceHdc),
                                     type,
                                     NativeMethods.NullHandleRef,
                                     MetafileFrameUnit.GdiCompatible,
                                     desc,
                                     out metafile));
            }
            else
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileI(
                                     new HandleRef(null, referenceHdc),
                                     type,
                                     ref frameRect,
                                     frameUnit,
                                     desc,
                                     out metafile));
            }

            SetNativeImage(metafile);
        }
Ejemplo n.º 27
0
 public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            // Called in order to emulate exception behavior from netfx related to invalid file paths.
            Path.GetFullPath(fileName);

            IntPtr metafile = IntPtr.Zero;

            if (frameRect.IsEmpty)
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileFileName(
                                     fileName,
                                     new HandleRef(null, referenceHdc),
                                     type,
                                     NativeMethods.NullHandleRef,
                                     frameUnit,
                                     description,
                                     out metafile));
            }
            else
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileFileNameI(
                                     fileName,
                                     new HandleRef(null, referenceHdc),
                                     type,
                                     ref frameRect,
                                     frameUnit,
                                     description,
                                     out metafile));
            }

            SetNativeImage(metafile);
        }
Ejemplo n.º 29
0
		public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
			EmfType type, string description) 
		{
			Status status = GDIPlus.GdipRecordMetafileFileName (fileName, referenceHdc, type, ref frameRect, frameUnit, 
				description, out nativeObject);
			GDIPlus.CheckStatus (status);
		}
Ejemplo n.º 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
                                 new GPStream(stream),
                                 new HandleRef(null, referenceHdc),
                                 type,
                                 ref frameRect,
                                 frameUnit,
                                 description,
                                 out IntPtr metafile));

            SetNativeImage(metafile);
        }
Ejemplo n.º 31
0
        public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type,
                        string description)
        {
            int status = Gdip.GdipRecordMetafile(referenceHdc, type, ref frameRect, frameUnit,
                                                 description, out nativeImage);

            Gdip.CheckStatus(status);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            IntPtr metafile = IntPtr.Zero;

            if (frameRect.IsEmpty)
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
                                     new GPStream(stream),
                                     new HandleRef(null, referenceHdc),
                                     type,
                                     NativeMethods.NullHandleRef,
                                     frameUnit,
                                     description,
                                     out metafile));
            }
            else
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileStreamI(
                                     new GPStream(stream),
                                     new HandleRef(null, referenceHdc),
                                     type,
                                     ref frameRect,
                                     frameUnit,
                                     description,
                                     out metafile));
            }

            SetNativeImage(metafile);
        }
Ejemplo n.º 33
0
 public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
                 EmfType type) : this(fileName, referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Ejemplo n.º 34
0
        /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile10"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class from the specified device context,
        ///       bounded by the specified rectangle.
        ///    </para>
        /// </devdoc>
        public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, String description)
        {
            IntSecurity.ObjectFromWin32Handle.Demand();

            IntPtr metafile = IntPtr.Zero;

            GPRECTF rectf  = new GPRECTF(frameRect);
            int     status = SafeNativeMethods.GdipRecordMetafile(new HandleRef(null, referenceHdc), (int)type, ref rectf, (int)frameUnit,
                                                                  description, out metafile);

            if (status != SafeNativeMethods.Ok)
            {
                throw SafeNativeMethods.StatusException(status);
            }

            SetNativeImage(metafile);
        }
Ejemplo n.º 35
0
 internal static extern int GdipRecordMetafileStreamI(Interop.Ole32.IStream stream, IntPtr referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string?description, out IntPtr metafile);
Ejemplo n.º 36
0
        /// <include file='doc\Metafile.uex' path='docs/doc[@for="Metafile.Metafile27"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Drawing.Imaging.Metafile'/> class with the
        ///       specified filename.
        ///    </para>
        /// </devdoc>
        public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            IntSecurity.DemandReadFileIO(fileName);
            IntSecurity.ObjectFromWin32Handle.Demand();

            IntPtr metafile = IntPtr.Zero;

            int status;

            if (frameRect.IsEmpty)
            {
                status = SafeNativeMethods.GdipRecordMetafileFileName(fileName, new HandleRef(null, referenceHdc), (int)type, NativeMethods.NullHandleRef, (int)frameUnit,
                                                                      description, out metafile);
            }
            else
            {
                GPRECT gprect = new GPRECT(frameRect);
                status = SafeNativeMethods.GdipRecordMetafileFileNameI(fileName, new HandleRef(null, referenceHdc), (int)type,
                                                                       ref gprect, (int)frameUnit,
                                                                       description, out metafile);
            }

            if (status != SafeNativeMethods.Ok)
            {
                throw SafeNativeMethods.StatusException(status);
            }

            SetNativeImage(metafile);
        }
Ejemplo n.º 37
0
        public Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string description)
        {
            IntSecurity.ObjectFromWin32Handle.Demand();
            IntPtr metafile = IntPtr.Zero;

            int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), 
                                                          new HandleRef(null, referenceHdc), 
                                                          unchecked((int)type),  
                                                          NativeMethods.NullHandleRef,
                                                          unchecked((int)MetafileFrameUnit.GdiCompatible), 
                                                          description,
                                                          out metafile);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeImage(metafile);
        }        
Ejemplo n.º 38
0
        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class from the specified device context, bounded
        /// by the specified rectangle.
        /// </summary>
        public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            Gdip.CheckStatus(Gdip.GdipRecordMetafile(
                                 referenceHdc,
                                 type,
                                 ref frameRect,
                                 frameUnit,
                                 description,
                                 out IntPtr metafile));

            SetNativeImage(metafile);
        }
Ejemplo n.º 39
0
 internal static extern int GdipRecordMetafileStreamI(IntPtr stream, IntPtr referenceHdc, EmfType emfType, Rectangle *frameRect, MetafileFrameUnit frameUnit, string?description, IntPtr *metafile);
Ejemplo n.º 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
 /// </summary>
 public Metafile(string fileName, IntPtr referenceHdc, EmfType type) :
     this(fileName, referenceHdc, type, null)
 {
 }
Ejemplo n.º 41
0
		internal static extern Status GdipRecordMetafileFileNameI ([MarshalAs (UnmanagedType.LPWStr)] string filename, IntPtr hdc, EmfType type,
			ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
Ejemplo n.º 42
0
        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            // Called in order to emulate exception behavior from netfx related to invalid file paths.
            Path.GetFullPath(fileName);
            if (fileName.Length > MaxPath)
            {
                throw new PathTooLongException();
            }

            Gdip.CheckStatus(Gdip.GdipRecordMetafileFileName(
                                 fileName,
                                 referenceHdc,
                                 type,
                                 ref frameRect,
                                 frameUnit,
                                 description,
                                 out IntPtr metafile));

            SetNativeImage(metafile);
        }
Ejemplo n.º 43
0
		static internal extern Status GdipRecordMetafileFromDelegateI_linux (StreamGetHeaderDelegate getHeader, 
			StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, 
			StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref Rectangle frameRect, 
			MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
Ejemplo n.º 44
0
 /// <summary>
 /// Initializes a new instance of the <see cref='Metafile'/> class from the specified data stream.
 /// </summary>
 public Metafile(Stream stream, IntPtr referenceHdc, EmfType type) :
     this(stream, referenceHdc, type, null)
 {
 }
Ejemplo n.º 45
0
	public Metafile(IntPtr referenceHdc, EmfType emfType)
			: this(referenceHdc, emfType, null) {}
Ejemplo n.º 46
0
		public Metafile(EmfType type)
		{
			CreateInternalMetafile(type);	
		}
Ejemplo n.º 47
0
	public Metafile(String fileName, IntPtr referenceHdc, EmfType type)
			: this(fileName, referenceHdc, type, null) {}
Ejemplo n.º 48
0
		public Metafile (Stream stream, IntPtr referenceHdc, EmfType type) :
			this (stream, referenceHdc, new RectangleF (), MetafileFrameUnit.GdiCompatible, type, null)
		{
		}
Ejemplo n.º 49
0
	public Metafile(String fileName, IntPtr referenceHdc,
					Rectangle frameRect, MetafileFrameUnit frameUnit,
					EmfType type, String description)
			{
				// TODO
			}
Ejemplo n.º 50
0
		public Metafile (string fileName, IntPtr referenceHdc, EmfType type, string description) :
			this (fileName, referenceHdc, new RectangleF (), MetafileFrameUnit.GdiCompatible, type, description)
		{
		}
Ejemplo n.º 51
0
		public Metafile (IntPtr referenceHdc, EmfType emfType, string description) :
			this (referenceHdc, new RectangleF (), MetafileFrameUnit.GdiCompatible, emfType, description)
		{
		}
Ejemplo n.º 52
0
 public Metafile(string fileName, IntPtr referenceHdc, EmfType type, string description)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 53
0
		public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) :
			this (referenceHdc, frameRect, frameUnit, type, null)
		{
		}
Ejemplo n.º 54
0
 public Metafile(IntPtr referenceHdc, EmfType emfType, string description) :
     this(referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, emfType, description)
 {
 }
Ejemplo n.º 55
0
		public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit,
			EmfType type) : this (stream, referenceHdc, frameRect, frameUnit, type, null)
		{
		}
Ejemplo n.º 56
0
 public Metafile(Stream stream, IntPtr referenceHdc, EmfType type) :
     this(stream, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, type, null)
 {
 }
Ejemplo n.º 57
0
		public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, 
			EmfType type, string description) 
		{
			if (stream == null)
				throw new NullReferenceException ("stream");

			Status status = Status.NotImplemented;
			if (GDIPlus.RunningOnUnix ()) {
				// With libgdiplus we use a custom API for this, because there's no easy way
				// to get the Stream down to libgdiplus. So, we wrap the stream with a set of delegates.
				GDIPlus.GdiPlusStreamHelper sh = new GDIPlus.GdiPlusStreamHelper (stream, false);
				status = GDIPlus.GdipRecordMetafileFromDelegate_linux (sh.GetHeaderDelegate, sh.GetBytesDelegate, 
					sh.PutBytesDelegate, sh.SeekDelegate, sh.CloseDelegate, sh.SizeDelegate, referenceHdc, 
					type, ref frameRect, frameUnit, description, out nativeObject);
			} else {
				status = GDIPlus.GdipRecordMetafileStream (new ComIStreamWrapper (stream), referenceHdc, 
					type, ref frameRect, frameUnit, description, out nativeObject);
			}
			GDIPlus.CheckStatus (status);
		}
Ejemplo n.º 58
0
 public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) :
     this(referenceHdc, frameRect, frameUnit, type, null)
 {
 }
Ejemplo n.º 59
0
 public Metafile GetMetafile(EmfType type)
 {
     int w = this.ClientRectangle.Width;
     int h = this.ClientRectangle.Height;
     Metafile metafile;
     using (var g = CreateGraphics())
     {
         IntPtr hdc = g.GetHdc();
         metafile = new Metafile(hdc, type);
         g.ReleaseHdc(hdc);
     }
     using (var g = Graphics.FromImage(metafile))
         DoPaint(g, w, h);
     return metafile;
 }
Ejemplo n.º 60
0
 public Metafile(string fileName, IntPtr referenceHdc, EmfType type, string description) :
     this(fileName, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, type, description)
 {
 }