PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
BeginContainer(...), EndContainer() of XGraphics class https://forum.pdfsharp.net/viewtopic.php?f=3&t=1755 |
Page 1 of 1 |
Author: | denhnure [ Thu Aug 25, 2011 9:49 am ] |
Post subject: | BeginContainer(...), EndContainer() of XGraphics class |
Hi everyone! Results after using these functions of XGraphics vary from results which we get from .NET Graphics functions BeginContainer(...), EndContainer(). Is it bug or feature? |
Author: | Thomas Hoevel [ Thu Aug 25, 2011 11:09 am ] |
Post subject: | Re: BeginContainer(...), EndContainer() of XGraphics class |
denhnure wrote: Is it bug or feature? I dunno. What's different? |
Author: | denhnure [ Thu Aug 25, 2011 12:17 pm ] | ||
Post subject: | Re: BeginContainer(...), EndContainer() of XGraphics class | ||
This is an extract from my WinForms application: override protected void OnPaint(PaintEventArgs e) { // Create a new PDF document PdfDocument document = new PdfDocument(); // Create an empty page PdfPage page = document.AddPage(); XGraphics gfx = XGraphics.FromGraphics(e.Graphics, new XSize(100, 100)); // Define transformation for container. Rectangle srcRect = new Rectangle(0, 0, 200, 200); Rectangle destRect = new Rectangle(100, 100, 150, 150); // Begin graphics container. XGraphicsContainer containerState1 = gfx.BeginContainer( destRect, srcRect, XGraphicsUnit.Point); // Fill red rectangle in container. gfx.DrawRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200); // End graphics container. gfx.EndContainer(containerState1); // Begin graphics container. GraphicsContainer containerState2 = e.Graphics.BeginContainer( destRect, srcRect, GraphicsUnit.Point); // Fill red rectangle in container. e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 200, 200); // End graphics container. e.Graphics.EndContainer(containerState2); // Save the document... const string filename = "C:\\HelloWorld_tempfile.pdf"; document.Save(filename); // ...and start a viewer. //Process.Start(filename); }
|
Author: | Thomas Hoevel [ Thu Aug 25, 2011 12:58 pm ] |
Post subject: | Re: BeginContainer(...), EndContainer() of XGraphics class |
I think it's a bug (my boss will have to look at it, but he's currently unavailable). |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |