/// <summary> /// Creates an example described on http://wmf.codeplex.com/discussions/430250 /// </summary> /// <param name="path"></param> /// <remarks> /// Thanks to aweswhen for finding the solution. /// </remarks> public static void CreateOddTextLengthSample(string path) { var wmf = new Oxage.Wmf.WmfDocument(); wmf.Width = 700; wmf.Height = 1400; wmf.Format.Unit = 288; //wmf.AddPolyFillMode(Oxage.Wmf.PolyFillMode.WINDING); //wmf.AddCreateBrushIndirect(Color.Blue, Oxage.Wmf.BrushStyle.BS_SOLID); //wmf.AddSelectObject(0); wmf.AddCreatePenIndirect(Color.Black, Oxage.Wmf.PenStyle.PS_SOLID, 1); wmf.AddSelectObject(0); wmf.AddRectangle(100, 100, 500, 2000); wmf.AddCircle(500, 1200, 100); wmf.AddCreateFontIndirect("arial", 60); wmf.AddSelectObject(1); wmf.AddText("1000", new Point(400, 1100)); wmf.AddText("wikywhen", new Point(100, 1100)); //Even-length text wmf.AddText("hello world", new Point(100, 800)); //Odd-length text wmf.AddDeleteObject(0); wmf.AddDeleteObject(1); //wmf.AddCircle(50, 50, 200); wmf.Save(path); }
public static WmfDocument GetExampleFromSpecificationDocument() { var wmf = new WmfDocument(); wmf.Records.Clear(); //META_HEADER wmf.Records.Add(new WmfHeader() { Type = (MetafileType)0x0001, HeaderSize = 0x0009, Version = 0x0300, FileSize = 0x36, NumberOfObjects = 0x02, MaxRecord = 0x0C, NumberOfMembers = 0x00 }); //META_CREATEPENINDIRECT wmf.Records.Add(new WmfCreatePenIndirectRecord() { Style = (PenStyle)0x0004, Width = new Point(0, 0), Color = Color.FromArgb(0, 0, 0) }); //META_SELECTOBJECT wmf.Records.Add(new WmfSelectObjectRecord() { ObjectIndex = 0 }); //META_CREATEBRUSHINDIRECT wmf.Records.Add(new WmfCreateBrushIndirectRecord() { Style = (BrushStyle)0x0002, Color = Color.FromArgb(0xFF, 0x00, 0xFF), Hatch = (HatchStyle)0x0004 }); //META_SELECTOBJECT wmf.Records.Add(new WmfSelectObjectRecord() { ObjectIndex = 1 }); //META_RECTANGLE wmf.Records.Add(new WmfRectangleRecord() { BottomRect = 0x0046, RightRect = 0x0096, TopRect = 0x0000, LeftRect = 0x0000 }); //META_TEXTOUT wmf.Records.Add(new WmfTextoutRecord() { StringLength = 0x000C, StringValue = "Hello People", YStart = 0x000A, XStart = 0x000A }); //META_EOF wmf.Records.Add(new WmfEndOfFileRecord()); return(wmf); }