178.94K
Category: programmingprogramming

The graphical capabilities of C# language

1.

The graphical capabilities of C #
language

2.

Plan
1. Main statements
2. Examples

3.

Void setBackground(Color newColor) – determines the
background color;
Void setForeground(Color newColor) – determines the color
of the picture;
void drawstring(String msg, int x, int y)- output a string
given in the parameter mcg from the coordinate x, y

4.

void drawline(int startX, int startY, int endX, endY) – draws
a line along the initial and final coordinates;
void drawRect(int top, int left, int width, int height) – draws
the rectangle contour, the first two parameters define the
upper left corner coordinates and the final parameters
define the rectangle dimensions;
;

5.

void drawOval(int top, int left, int width, int height) – Draws
an arc or circle inside a rectangle and for to draw a circle
give rectangle as a square;
void drawArc(int top, int left, int width, int height, int
startAngle, int sweepAngle)
- the first two parameters
define the upper left corner coordinates, and the next two
options determine the rectangle dimensions, the final
parameter determines the arc angle, and if the last
parameter is positive, the arc is plotted counter-clockwise,
and the negative is clockwise.

6.

Graphics grf = this.CreateGraphics();
Brush kst = new
SolidBrush(Color.Pink);
Pen pr = new Pen(Color.Red);
grf.DrawEllipse(pr, 50, 50, 150, 150);
grf.DrawLine(pr, 20, 20, 350, 250);
Pen pr1 = new
Pen(Color.GreenYellow);
grf.DrawRectangle(pr1, 60, 60, 250,
350);

7.

Rectangle rec=new Rectangle(300,20,
480,200);
grf.DrawPie(pr1, 350, 100, 150, 150,
45, 90);
grf.FillPie(kst, 20, 50, 150, 150, 0, 45);
string st = "graf obekt salu";
Font = new Font("Times New Roman", 14);
grf.DrawString(st, Font, kst, 350, 50);
grf.DrawArc(pr, rec, 45, 180);
grf.DrawEllipse(pr1, 250, 250, 150, 250);

8.

Examples
1. draw a ship
2. draw a model of a modern computer
3. draw a specialty emblem

9.

10.

}
}
English     Русский Rules