PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 5:11 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Aug 09, 2022 12:26 pm 
Offline

Joined: Mon Sep 28, 2020 8:33 am
Posts: 5
I am attempting to draw a filled rectangle on the document.

If I do this the rectangle is filled in

Code:
 XRect tableHeader = new XRect(20, 250, 550, 15);
            gfx.DrawRectangle(XPens.LightBlue, XBrushes.LightBlue, tableHeader);


If I do this the outline of the rectangle is only shown.

Code:
         XRect tableHeader = new XRect(20, 250, 550, 15);
            XBrush tableHeaderBackground = new XSolidBrush(new XColor { R = 222, G = 234, B = 246});
            gfx.DrawRectangle(XPens.LightBlue, tableHeaderBackground, tableHeader);


What am I missing here?

TIA


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 09, 2022 9:11 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
Congratulations, you created a brush that is 100% transparent.

Use this code to create a transparency of 50%:
Code:
XBrush brush = new XSolidBrush(XColor.FromArgb(128, 255, 0, 0));


Use this code to create a transparency of 0%:
Code:
XBrush brush = new XSolidBrush(XColor.FromArgb(255, 0, 0));

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 26 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