, Visual C#


- 2


width_of_rectangle, height_of_rectangle);

 

myGraphics.DrawLine(new Pen(Color.Red, 3),

width_of_rectangle, boundary_of_rectangle_,

width_of_rectangle, height_of_rectangle);

// ,

//:

Font drawFont = new Font("Times New Roman", 100,

FontStyle.Bold, GraphicsUnit.Point);

 

// , :

string drawText = "Visual";

 

//

// MeasureString:

SizeF SizeF_of_Text = new

SizeF(myGraphics.MeasureString(drawText, drawFont));

 

// ,

// ,

// :

PointF Start_of_drawPointF =

new PointF(Convert.ToSingle((width_of_rectangle

- SizeF_of_Text.Width) / 2),

Convert.ToSingle((height_of_rectangle

- SizeF_of_Text.Height) / 2));

 

//

// ; ,

// :

PointF Start_of_Gradient_of_drawPointF =

new PointF(0, 0);

PointF End_of_Gradient_of_drawPointF =

new PointF(Shift_of_Gradient, 200);

 

// drawBrush LinearGradientBrush

//

// :

LinearGradientBrush drawBrush = new

LinearGradientBrush(Start_of_Gradient_of_drawPointF,

End_of_Gradient_of_drawPointF, Color.Red, BackColor);

 

// :

myGraphics.DrawString(drawText, drawFont,

drawBrush, Start_of_drawPointF);