首页  韩国资源  酷站加油  我的展厅  设计名站  古典元素  推荐下载  设计欣赏  每周专访  招募精英  人才专区  网页教程  平面设计  编程开发  设计竞赛
当前位置:首页 > 编程开发 > ASP.net教程 > Asp.Net实例教程 > 正文
Google
讲解.NET环境下绘制模糊数学中隶属函数分布图
来源:CSDN 作者:常青藤 2007年11月23日 08:43 网友评论:1条 点击:

以下是引用片段:
  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 < 6.28F; d += interval)
  ...{
  x1 = o.X + d * unit;
  x2 = o.X + (d + interval) * unit;
  y1 = o.Y - (float)(unit * System.Math.Sin(d));
  y2 = o.Y - (float)(unit * System.Math.Sin(d + interval));
  p1 = new PointF(x1, y1);
  p2 = new PointF(x2, y2);
  e.Graphics.DrawLine(Pens.Black, p1, p2);
  }
  }
  else if (type1 == 1)
  ...{
  //set1();
  PointF o1 = new PointF(this.pictureBox1.Width/2, this.pictureBox1.Height / 4);
  e.Graphics.DrawString("1", font, brush, o1);


  if (type2 == 1)
  ...{
  for (d = 0; d < a; d += interval)
  ...{
  x1 = o.X + d * unit;
  x2 = o.X + (d + interval) * unit;
  y1 = o.Y - (float)(this.pictureBox1.Height / 4);
  y2 = o.Y - (float)(this.pictureBox1.Height / 4);
  p1 = new PointF(x1, y1);
  p2 = new PointF(x2, y2);
  e.Graphics.DrawLine(Pens.Black, p1, p2);
  tempx = x2;
  tempy = this.pictureBox1.Height/2;
  }
  PointF o2 = new PointF(tempx, tempy);
  e.Graphics.DrawString(a.ToString(), font, brush, o2);
  }
  else if (type2 == 2)
  ...{
  for (d = a; d < 2*a; d += interval)


  ...{
  x1 = o.X + d * unit;
  x2 = o.X + (d + interval) * unit;
  y1 = o.Y - (float)(this.pictureBox1.Height / 4);
  y2 = o.Y - (float)(this.pictureBox1.Height / 4);
  p1 = new PointF(x1, y1);
  p2 = new PointF(x2, y2);
  e.Graphics.DrawLine(Pens.Blue, p1, p2);
  }
  PointF o2 = new PointF(tempx, tempy);
  e.Graphics.DrawString(a.ToString(), font, brush, o2);
  }
  else if (type2 == 3)
  ...{
  for (d = a; d 
  ...{
  x1 = o.X + d * unit;
  x2 = o.X + (d + interval) * unit;
  y1 = o.Y - (float)(this.pictureBox1.Height / 4);


  y2 = o.Y - (float)(this.pictureBox1.Height / 4);
  p1 = new PointF(x1, y1);
  p2 = new PointF(x2, y2);
  e.Graphics.DrawLine(Pens.Blue, p1, p2);
  }
  PointF o2 = new PointF(tempx, tempy);
  e.Graphics.DrawString(a.ToString(), font, brush, o2);
  }
  }
  else if (type1 == 2)
  ...{
  //set2();
  PointF o1 = new PointF(this.pictureBox1.Width/2, this.pictureBox1.Height / 4);
  e.Graphics.DrawString("1", font, brush, o1);

首页 上一页 [1] [2] [3] [4] [5] 下一页 尾页
上一篇:实现用 C# 编程读写 Binary   下一篇:实现.net的 TreeView客户端两个个性化操作
收藏此页】【打印】【关闭
 相关文章  我要点评
·.Net(C#)关于变量的命名和属性
·通过ASP.NET编程进行远程杀死进程
·ASP.NET的应用程序域须知
·asp根据表单自动生成sql语句的函数
·介绍Sandcastle 生成.NET API文档的工具
·不通过"lower"等函数查询大小写的内容
·ASP.NET最常见错误提示
·不用组件实现Ajax效果

免责声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。对本文有任何异议,请联络:68design#163.com
转载要求:作者及来源信息必需保留。转载之图片、文件,链接请不要盗链到本站,且不准打上各自站点的水印。



关于我们 | 在线反馈 | 广告报价 | 友情链接 | 联系我们 | 免责声明 | 在线投稿 | 网站地图
Copyright © 2003-2007 68design.net, All Rights Reserve 【找网页设计师,当然上网页设计师联盟】