Current location - Training Enrollment Network - Mathematics courses - Vb.net read the txt data into a problem.
Vb.net read the txt data into a problem.
I. Analysis:

1, a graph that changes with time, usually takes the horizontal axis as the time and the vertical axis as the corresponding value, and here is the density value.

2. The point set is a line; A set of time and density values corresponding to a point connect these points to form a line.

Two, drawing in VB.NET, we need to understand and solve several problems:

1, like VB6, is the default coordinate system of VB.NET. The upper left corner is the coordinate origin, the positive direction of the X axis is from left to right, and the positive direction of the Y axis is from top to bottom.

In order to make it consistent with the coordinate system in mathematics, two methods of VB.NET's graph class can be used;

1, TranslateTransform-translation transformation

Format: graphics.translatetransform (dx, dy)

Where dx and dy are single data types respectively.

2, ScaleTransform-scaling transformation

Format: graphics. Scaling transformation (sx, sy)

Where sx and sy are single data types respectively;

For example, in order to conform to the general format in mathematics, you can use the following code:

Graphics. ScaleTransform( 1,- 1)

So the positive direction of the y axis is reversed.

Third, draw pictures in VB.NET.

1, draw a circle or ellipse.

Painting trilogy

1, get a graphic object.

Dim my graphics into graphics.

My graphics = me. Create graphics

2. Define the pen object used to draw the figure (outline).

Darken my pen to a new pen (color. Black)

3. Define a brush object to fill the graph (if necessary).

Dim MyBrush to a new SolidBrush (color. Orange)

Draw a solid circle in the rectangular area bounded by straight lines x=200, y=200, x=200+ 100 and y=200+ 100.

My graphics. Fillet (brush, 200,200, 100, 100)

Draw a hollow circle in the rectangular area bounded by straight lines x=200, y=200, x=200+ 100, y=200+ 100.

My graphics. DrawEllipse (pen, 200,200, 100, 100)

Note: If the last two values are not equal, an ellipse will be drawn.

When a circle is small enough, it is a point.

2. Draw a straight line

1, get a graphic object.

Dim my graphics into graphics.

My graphics = me. Create graphics

2. Define the pen object used to draw the figure (outline).

Darken my pen to a new pen (color. Black)

My graphics. Draw a line (my pen, 200,200, 100, 100)

Or use it directly

Me. CreateGraphics.DrawLine (new pen (color. Black), 50, 50, 200, 200)