We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply custom color in PdfLightTable cell background

Platform: WinForms |
Control: PDF |
Published Date: November 27, 2017 |
Last Revised Date: May 6, 2019

Apply custom color in PdfLightTable cell background

Custom background color for the PdfGridCell can be applied using BackgroundBrush property in PdfCellStyle,

The code snippet for the same can be found below:

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
 
//Add a page.
PdfPage page = doc.Pages.Add();
 
var headerStyle = new PdfCellStyle
{
       BackgroundBrush = new PdfSolidBrush(new PdfColor(Color.FromArgb(255,109, 175, 61))),
       BorderPen = new PdfPen(new PdfColor(Color.FromArgb(255, 109, 175, 61)))
};
var defaultStyle = new PdfCellStyle
{
      TextBrush = PdfBrushes.Black,
     BorderPen = new PdfPen(new PdfColor(Color.FromArgb(255, 109, 175, 61)))
};
 
var pdfLightTable = new PdfLightTable
{
      Style =
      {
          BorderPen = new PdfPen(new PdfColor(Color.FromArgb(255, 109, 175, 61))),
          ShowHeader=true,
          RepeatHeader=true,
          HeaderStyle=headerStyle,
          DefaultStyle=defaultStyle
      }             
};

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-62113850

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon