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

drawing 2 times rectangles with different gradient brushes

Thread ID:





47725 Aug 10,2006 05:24 PM UTC Aug 10,2006 08:18 PM UTC WinForms 1
Tags: PDF
Tom Arstrong
Asked On August 10, 2006 05:24 PM UTC

It seems that if I drawing 2 times rectangles with different gradient brushes it failes, ir it true?

In other words can you show me working version of drawing 2 times rectangles with different gradient brushes

props.GradientMode = doc.CreateGradientInfo(
Color.FromArgb(100, 100, 100), Color.FromArgb(255, 255, 255), LinearGradientMode.Horizontal );

RectangleF rect = new RectangleF( 100, 100, 100, 100 );
doc.LastPage.Graphics.DrawRectangle( rect, props );

props.GradientMode = doc.CreateGradientInfo(
Color.FromArgb(100, 100, 101), Color.FromArgb(255, 255, 255), LinearGradientMode.Horizontal );
rect = new RectangleF( 100, 100, 100, 101 );
doc.LastPage.Graphics.DrawRectangle( rect, props );

Ajish [Syncfusion]
Replied On August 10, 2006 08:18 PM UTC

Hi Tom,

Use the following code to set Gradient Brush and to draw a rectangle with this graphics property

props.Brush = pdfDoc.CreateGradientBrush(Color.FromArgb(255,187,111), Color.FromArgb(33,67,126), LinearGradientMode.ForwardDiagonal );
pdfDoc.LastPage.Graphics.DrawRectangle ( 0, 0, 300, 200, props );

props.Brush = pdfDoc.CreateGradientBrush(Color.Blue, Color.White , LinearGradientMode.Horizontal );
pdfDoc.LastPage.Graphics.DrawRectangle ( 0,300, 300, 200, props );

Here is sample for your reference which draws two rectangle with different Gradient brush.


Please take a look and let me know if you have any questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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