PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
XGraphics.DrawRectangle colouring https://forum.pdfsharp.net/viewtopic.php?f=2&t=1911 |
Page 1 of 1 |
Author: | hoylemd [ Thu Feb 16, 2012 4:28 pm ] |
Post subject: | XGraphics.DrawRectangle colouring |
Hi all, Is there a way to draw a filled in rectangle with an arbitrary colour? All I can seem to do is use the pre-defined XBrushes, and there doesn't seem to be a way to make a new XBrush. In addition, is there an easy way to draw a rectangle with a certain fill pattern (diagonal lines, etc)? |
Author: | hoylemd [ Tue Feb 21, 2012 4:20 pm ] |
Post subject: | Re: XGraphics.DrawRectangle colouring |
I've sort of found a solution to this. I can create new brushes, I just didn't realise XBrush was an abstract class. I had to instantiate a new XSolidBrush with the specified colour. The only problem is that with custom XColor objects, the rectangles don't seem to show up. Has anyone seen this before or know what's going on? I'm using the GDI+ version if that affects it. |
Author: | Thomas Hoevel [ Tue Feb 21, 2012 4:59 pm ] |
Post subject: | Re: XGraphics.DrawRectangle colouring |
hoylemd wrote: The only problem is that with custom XColor objects, the rectangles don't seem to show up. How do you specify the color? Make sure opacity is 100 % (the a in argb should be 255).
|
Author: | hoylemd [ Wed Feb 22, 2012 6:43 pm ] |
Post subject: | Re: XGraphics.DrawRectangle colouring |
Ah! That's probably the problem. I'm parsing the colour out of a 32-bit integer that only has the RGB values set, so it's probably assuming an alpha channel value of 0. Thanks! |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |