SoFunction
Updated on 2025-04-11

Explain the drawing of membership function distribution diagram in fuzzy mathematics in .NET environment, page 5/5


The entire source code is as above.

First: Overload the pictureBox1_Paint function

When drawing pictures, the idea is very simple. Determine the starting position and the end position. In this program, I use objects to store point coordinates.

Use (, Coordinate 1, Coordinate 2) to draw lines.

 

Below I will introduce the drawing of a normal distribution graph:

The program block is as follows:

The following is a quoted snippet:
for (d = a; d <= 2 * a; d += interval) 

x1 =  + d * unit; 
x2 =  + (d + interval) * unit; 
y1 =  - (float)((-((d - a) / k) * ((d - a) / k)) * unit); 
y2 =  - (float)((-((d - interval - a) / k) * ((d - interval - a) / k)) * unit); 

p1 = new PointF(x1, y1); 
p2 = new PointF(x2, y2); 
(, p1, p2); 



Among them: unit represents the graphic magnification, the larger the magnification, the larger the graphic magnification.

interval represents stepping scale. The smaller the value, the more accurate it is (must be 0), but the slower the speed is.

First determine the starting coordinate (x1,y1), then combine the normal distribution with an addition of a step scale to determine (x2,y2), and then call to draw.

 

Finally, there is another point. Since you have to call private void pictureBox1_Paint(object sender, PaintEventArgs e) every time you re-draw the picture, it is not a user-defined method, so the user handle re-gets the PictureBox_Paint method and re-draws the figure. The code segment is as follows:

The following is a quoted snippet:
Graphics g = (this.); 
PaintEventArgs e1 = new PaintEventArgs(g, this.); 
this.pictureBox1_Paint(this.pictureBox1, e1); 
(); 
Previous page12345Read the full text