当前位置: 编程技术>.net/c#/asp.net
讲解.NET环境下绘制模糊数学中隶属函数分布图第1/5页
来源: 互联网 发布时间:2014-10-13
本文导语: 绘制模糊数学中隶属函数分布图 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Collections; using System.Windows...
绘制模糊数学中隶属函数分布图
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Collections;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
namespace ImageFuzzy
...{
public partial class Form1 : Form
...{
private int type1;
private int type2;
private string item1;
private string item2;
private float a;
private float b;
private float c;
private float d1;
private float k;
private float l;
private float tempx;
private float tempy;
public void InitArray()
...{
type1 = 0;
type2 = 0;
k = 2;
item1 = this.comboBox1.Text.ToString();
item2 = this.comboBox2.Text.ToString();
this.groupBox1.Text = item1 + item2 + "图形";
a = float.Parse(this.tbA.Text.Trim().ToString());
b = float.Parse(this.tbB.Text.Trim().ToString());
c = float.Parse(this.tbC.Text.Trim().ToString());
d1 = float.Parse(this.tbD.Text.Trim().ToString());
k = float.Parse(this.tbK.Text.Trim().ToString());
l = float.Parse(this.tbL.Text.Trim().ToString());
type1 = this.comboBox1.SelectedIndex+1;
type2 = this.comboBox2.SelectedIndex+1;
}
private void delete()
...{
a = 0;
b = 0;
c = 0;
d1 = 0;
k = 0;
l = 0;
}
private void set1()
...{
this.tbA.Text = "1";
this.tbB.Text = "2";
this.tbC.Text = "3";
this.tbD.Text = "4";
this.tbK.Text = "1";
this.tbL.Text = "2";
}
private void set2()
...{
this.tbA.Text = "1";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "2.5";
this.tbK.Text = "1";
this.tbL.Text = "2";
}
private void set3()
...{
this.tbA.Text = "0.5";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "3";
this.tbK.Text = "3";
this.tbL.Text = "2";
}
private void set4()
...{
this.tbA.Text = "1.5";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "2.5";
this.tbK.Text = "0.5";
this.tbL.Text = "2";
}
private void set5()
...{
this.tbA.Text = "2";
this.tbB.Text = "2.5";
this.tbC.Text = "3";
this.tbD.Text = "3.5";
this.tbK.Text = "4";
this.tbL.Text = "6";
}
private void set6()
...{
this.tbA.Text = "0.5";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "2.5";
this.tbK.Text = "2";
this.tbL.Text = "4";
}
public Form1()
...{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
...{
//set1();
}
private void Form1_Paint(object sender, PaintEventArgs e)
...{
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
...{
float d;
float x1;
float x2;
float y1;
float y2;
PointF p1;
PointF p2;
int unit = 40;//放大倍数
Font font = new Font("MS UI Gothic", 12);
SolidBrush brush = new SolidBrush(Color.Black);
float interval = 0.001F; //步进刻度,值越小越精确(必须大小0),但速度也越慢
PointF o = new PointF(this.pictureBox1.Width / 2, this.pictureBox1.Height / 2);
e.Graphics.DrawLine(Pens.Red, 0, this.pictureBox1.Height / 2, this.pictureBox1.Width, this.pictureBox1.Height / 2);
e.Graphics.DrawLine(Pens.Red, this.pictureBox1.Width / 2, 0, this.pictureBox1.Width / 2, this.pictureBox1.Height);
e.Graphics.DrawString("O", font, brush, o);
if (type1 == 0)
...{
for (d = -6.28F; d
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Collections;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
namespace ImageFuzzy
...{
public partial class Form1 : Form
...{
private int type1;
private int type2;
private string item1;
private string item2;
private float a;
private float b;
private float c;
private float d1;
private float k;
private float l;
private float tempx;
private float tempy;
public void InitArray()
...{
type1 = 0;
type2 = 0;
k = 2;
item1 = this.comboBox1.Text.ToString();
item2 = this.comboBox2.Text.ToString();
this.groupBox1.Text = item1 + item2 + "图形";
a = float.Parse(this.tbA.Text.Trim().ToString());
b = float.Parse(this.tbB.Text.Trim().ToString());
c = float.Parse(this.tbC.Text.Trim().ToString());
d1 = float.Parse(this.tbD.Text.Trim().ToString());
k = float.Parse(this.tbK.Text.Trim().ToString());
l = float.Parse(this.tbL.Text.Trim().ToString());
type1 = this.comboBox1.SelectedIndex+1;
type2 = this.comboBox2.SelectedIndex+1;
}
private void delete()
...{
a = 0;
b = 0;
c = 0;
d1 = 0;
k = 0;
l = 0;
}
private void set1()
...{
this.tbA.Text = "1";
this.tbB.Text = "2";
this.tbC.Text = "3";
this.tbD.Text = "4";
this.tbK.Text = "1";
this.tbL.Text = "2";
}
private void set2()
...{
this.tbA.Text = "1";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "2.5";
this.tbK.Text = "1";
this.tbL.Text = "2";
}
private void set3()
...{
this.tbA.Text = "0.5";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "3";
this.tbK.Text = "3";
this.tbL.Text = "2";
}
private void set4()
...{
this.tbA.Text = "1.5";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "2.5";
this.tbK.Text = "0.5";
this.tbL.Text = "2";
}
private void set5()
...{
this.tbA.Text = "2";
this.tbB.Text = "2.5";
this.tbC.Text = "3";
this.tbD.Text = "3.5";
this.tbK.Text = "4";
this.tbL.Text = "6";
}
private void set6()
...{
this.tbA.Text = "0.5";
this.tbB.Text = "1.5";
this.tbC.Text = "2";
this.tbD.Text = "2.5";
this.tbK.Text = "2";
this.tbL.Text = "4";
}
public Form1()
...{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
...{
//set1();
}
private void Form1_Paint(object sender, PaintEventArgs e)
...{
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
...{
float d;
float x1;
float x2;
float y1;
float y2;
PointF p1;
PointF p2;
int unit = 40;//放大倍数
Font font = new Font("MS UI Gothic", 12);
SolidBrush brush = new SolidBrush(Color.Black);
float interval = 0.001F; //步进刻度,值越小越精确(必须大小0),但速度也越慢
PointF o = new PointF(this.pictureBox1.Width / 2, this.pictureBox1.Height / 2);
e.Graphics.DrawLine(Pens.Red, 0, this.pictureBox1.Height / 2, this.pictureBox1.Width, this.pictureBox1.Height / 2);
e.Graphics.DrawLine(Pens.Red, this.pictureBox1.Width / 2, 0, this.pictureBox1.Width / 2, this.pictureBox1.Height);
e.Graphics.DrawString("O", font, brush, o);
if (type1 == 0)
...{
for (d = -6.28F; d
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。