Half-minute introduction GDI +
Graphics created
After the object, you can draw various images and images. You only need to call its method, you can draw to create
Graphics
.
①
Step 1 always gets a graphics
Object. You can use
Creategraphics
() Method. Remember,
Graphics
Implemented
Idisposable
Interface, so if you create
Graphics
Object, use
Using
Statement.
②
If you want to draw a line, call drawline
() Method. The parameter is
X
And
Y
Coordinates indicate the start and end points:
Or use two
It can also be used as a parameter:
③
The following code draws a gray rectangle of the filled stone and draws a sky-blue border for it. It uses a rectangle
To define the drawing Area
--
Here, the upper left corner is (
150
,
15
), Width is
140
, High
90.
④
Drawcircle can be used
() Or
Fillcircle
() Method to draw an elliptic or circle. The two methods also use
Rectangle
To specify the image size. The following code draws two ovans, which are slightly staggered to render the shadow effect:
⑤
Use drawstring
() Method can draw text of any font and color. To use this method, you must create
Font
Object. It implements
Idisposable
To use
Using
Statement: