Which code segment should you use?

You are creating a custom Windows Forms control. On the background of the control, an ellipse completely filled with a colored gradient is drawn. The bounds for the ellipse are equal to the bounds for the control. The control must correctly repaint itself in all situations. You need to include the drawing of the ellipse in the OnPaint event handler for the custom control. Which code segment should you use?

You are creating a custom Windows Forms control. On the background of the control, an ellipse completely filled with a colored gradient is drawn. The bounds for the ellipse are equal to the bounds for the control. The control must correctly repaint itself in all situations. You need to include the drawing of the ellipse in the OnPaint event handler for the custom control. Which code segment should you use?

A.
Brush linearGradientBrush = new LinearGradientBrush(e.ClipRectangle, startGradient, endGradient, 45);

B.
Brush linearGradientBrush = new LinearGradientBrush( new Point(this.Left, this.Top),
new Point(this.Right, this.Bottom),
startGradient, endGradient);

C.
Graphics.FillEllipse(1inearGradientBrush, e.ClipRectangle);

D.
Brush linearGradientBrush = new LinearGradientBrush( new Rectangle(this.Left, this.Top, this.Width, this.Height), startGradient, endGradient, 45, true);

E.
Graphics.FillEllipse(linearGradientBrush,
this.Left, this.Top, this. Width, this.Height);

F.
Brush linearGradientBrush = new
LinearGradientBrush(this.ClientRectangle,
startGrafics.FillEllipse(linearGradientBrush, this.ClientRectangle);



Leave a Reply 0

Your email address will not be published. Required fields are marked *