PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Jul 19, 2024 5:17 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Feb 16, 2012 4:28 pm 
Offline

Joined: Thu Feb 09, 2012 4:59 pm
Posts: 14
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)?


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2012 4:20 pm 
Offline

Joined: Thu Feb 09, 2012 4:59 pm
Posts: 14
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2012 4:59 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 22, 2012 6:43 pm 
Offline

Joined: Thu Feb 09, 2012 4:59 pm
Posts: 14
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!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group