本文整理汇总了C#中EmfType类的典型用法代码示例。如果您正苦于以下问题:C# EmfType类的具体用法?C# EmfType怎么用?C# EmfType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EmfType类属于命名空间,在下文中一共展示了EmfType类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Metafile
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);
}
示例2: CreateInternalMetafile
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();
}
示例3: CreateMetafile
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;
}
示例4: Metafile
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);
}
示例5: Metafile
public Metafile(String fileName, IntPtr referenceHdc,
EmfType type, String description)
{
// TODO
}
示例6: Metafile
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);
}
示例7: Metafile
public Metafile(EmfType type)
{
CreateInternalMetafile(type);
}
示例8: Metafile
public Metafile(System.IntPtr referenceHdc, EmfType emfType) {}
示例9: GdipRecordMetafileFileNameI
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);
示例10: GdipRecordMetafileStreamI
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);
示例11: GdipRecordMetafileFromDelegateI_linux
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);
示例12: RecordFileName
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);
}
示例13: GetMetafile
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;
}