c# - Use Graphic.DrawLines(Pen pen, Points points) for Metafile, the picture cannot open when the count of points is large -
I have a problem with GDI + metafile. I want to save a metafile by graphic. It works well when the point number is 10000 and the saved metafile can be opened. But when the point number is large (eg calculation = 10000000), the metafile can not be opened by mspaint.exe.
Do not I miss anything? Is metafile record size limited? By the way, this problem is also in DraculaGallales
.
This is my code:
Private Zero Button 1_Click (Object Sender, EventArgs e) {Int width = 1489; Intensity height = 471; Graphics offscreen buffer graphics; Metaphil me; (Using memorystream stream = new memorystream ()) (offscreen buffer graphics = graphics.framhound internally (int.t.or.o)) {int pttrc consoletexhandle = offscreen buffer graphics. GATHDC (); M = new metafile (stream, device contex handle, new rectangle (0, 0, width, height), metafile frame unit pixel, iii. OffScreenBufferGraphics.ReleaseHdc (); }} (Graphics G = Graphics. Framesize (m)) {// Everything high quality g. SmoothingMode = Smoothing. G. Interpolation mode = Interpolation mode. Highquite bibbic; G.PixelOffsetMode = PixelOffsetMode.HighQuality; G.CompositingQuality = CompositingQuality.HighQuality; Metafile header metafile header = M. Gatemeta header (); G. Scale Transform (MetaFileHeader.dpiax / g.dpiax, MetaFileHeader.dpi / g.dpiI); G.PageUnit = GraphicsUnit.Pixel; G. Satclipp (new rectangle (0, 0, width, height)); // clears the image and colors the entire background. Clear (color white); Attract lines using pen pen (new pen (black, 1f)) {Random RD = new random (datetime.now.millisecond); & Lt; PointF & gt; PolyPoint = new list & lt; Pointf> (); Const int count = 10000; (Int i = 1; i
This seems like a limit if I use DrawLines Instead of using DrawPath , it works properly.
Comments
Post a Comment