drawing 2 times rectangles with different gradient brushes

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 );

1 Reply

AJ Ajish Syncfusion Team 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.

GraphicsBrush.zip


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

Thanks,
Ajish.

Loader.
Up arrow icon