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.
Unfortunately, activation email could not send to your email. Please try again.

drawing 2 times rectangles with different gradient brushes

Thread ID:





47725 Aug 10,2006 01:24 PM Aug 10,2006 04:18 PM Windows Forms 1
Tags: PDF
Tom Arstrong
Asked On August 10, 2006 01:24 PM

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 04:18 PM

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.

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.