Which code segment should you choose?

You are developing a utility screen for a new client application. The utility screen displays a thermometer that conveys the current status of processes being carried out by the application. You need to draw a rectangle on the screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be filled with gradient shading. (Click the Exhibit button.)

Which code segment should you choose?

You are developing a utility screen for a new client application. The utility screen displays a thermometer that conveys the current status of processes being carried out by the application. You need to draw a rectangle on the screen to serve as the background of the thermometer as shown in the exhibit. The rectangle must be filled with gradient shading. (Click the Exhibit button.)

Which code segment should you choose?

A.
Rectangle rectangle = new Rectangle(10, 10, 450, 25);
LinearGradientBrush rectangleBrush = new LinearGradientBrush(rectangle, Color.AliceBlue, Color.CornflowerBlue, LinearGradientMode.ForwardDiagonal);
Pen rectanglePen = new Pen(rectangleBrush);
Graphics g = this.CreateGraphics();
g.DrawRectangle(rectanglePen, rectangle);

B.
Rectangle rectangle = new Rectangle(10, 10, 450, 25);
LinearGradientBrush rectangleBrush = new LinearGradientBrush(rectangle, Color.AliceBlue, Color.CornflowerBlue, LinearGradientMode.ForwardDiagonal);
Pen rectanglePen = new Pen(rectangleBrush);
Graphics g = this.CreateGraphics();
g.FillRectangle(rectangleBrush, rectangle);

C.
RectangleF rectangle = new RectangleF(10f, 10f, 450f, 25f);
Point[] points = new Point[] {new Point(0, 0), new Point(110, 145)};
LinearGradientBrush rectangleBrush = new LinearGradientBrush(rectangle, Color.AliceBlue, Color.CornflowerBlue, LinearGradientMode.ForwardDiagonal);
Pen rectanglePen = new Pen(rectangleBrush);
Graphics g = this.CreateGraphics();
g.DrawPolygon(rectanglePen, points);

D.
RectangleF rectangle = new RectangleF(10f, 10f, 450f, 25f);
SolidBrush rectangleBrush = new SolidBrush(Color.AliceBlue);
Pen rectanglePen = new Pen(rectangleBrush);
Graphics g = this.CreateGraphics();
g.DrawRectangle(rectangleBrush, rectangle);



Leave a Reply 0

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