热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

讲解.NET环境下绘制模糊数学中隶属函数分布图第1/5页

讲解.NET环境下绘制模糊数学中隶属函数分布图
 绘制模糊数学中隶属函数分布图
  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);
12345下一页阅读全文

推荐阅读
  • 该楼层疑似违规已被系统折叠隐藏此楼查看此楼错误72error:ErroropeningoutputfileC:Users林鑫辰AppDataLocalTemptmpxft_0000 ... [详细]
  • 本文主要介绍关于人工智能,shell的知识点,对【winyyy.sys,hcpidesk.sys,mtlrd.sys,uldfhjfh.sys,servets.exe等1】和【】有兴趣的朋友可以看下由 ... [详细]
  • Valve 发布 Steam Deck 的新版 Windows 驱动程序
    Valve 最新发布了针对 Steam Deck 掌机的 Windows 驱动程序,旨在提升其在 Windows 环境下的兼容性、安全性和性能表现。 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • 在 Windows 10 中,F1 至 F12 键默认设置为快捷功能键。本文将介绍几种有效方法来禁用这些快捷键,并恢复其标准功能键的作用。请注意,部分笔记本电脑的快捷键可能无法完全关闭。 ... [详细]
  • 在Linux系统中配置并启动ActiveMQ
    本文详细介绍了如何在Linux环境中安装和配置ActiveMQ,包括端口开放及防火墙设置。通过本文,您可以掌握完整的ActiveMQ部署流程,确保其在网络环境中正常运行。 ... [详细]
  • DNN Community 和 Professional 版本的主要差异
    本文详细解析了 DotNetNuke (DNN) 的两种主要版本:Community 和 Professional。通过对比两者的功能和附加组件,帮助用户选择最适合其需求的版本。 ... [详细]
  • xmpphp测试openfire发布信息
    xmpphp测试openfire发布信息1.先下载xmpphp,地址:https:code.google.compxmpphpdownloadslist2.编写php脚本。<?php ... [详细]
  • PostgresX2 MPP部署试验
    2019独角兽企业重金招聘Python工程师标准MPP结构:129GTM节点,130coordinator、gtm_proxy、datanode& ... [详细]
  • A题这题贼水,直接暴力就可以了。用个bool数组记录一下,如果某一天,当前剩下的最大的出现了的话,就输出一段。1#include<stdio.h>2intn;3boolvi ... [详细]
  • #-*-coding:utf-8-*-print(upython与开源QGis课题研究组)#print(汉字)##创建矢量数据文件#try:fromosgeoimporto ... [详细]
  • html显示屏幕中心1,HTML中常见的长度单位
    8种机械键盘轴体对比本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?THML中常见的8种长度1、常见的单位px:像素 ... [详细]
  • 概念:组合模式(CompositePattern)将对象组合成树形结构以表示“部分-整体”的层次结构,组合模式使得用户对单个对象和组合对象的使用具有一致性。有时候又叫做部分-整体模 ... [详细]
  • 深入解析JVM垃圾收集器
    本文基于《深入理解Java虚拟机:JVM高级特性与最佳实践》第二版,详细探讨了JVM中不同类型的垃圾收集器及其工作原理。通过介绍各种垃圾收集器的特性和应用场景,帮助读者更好地理解和优化JVM内存管理。 ... [详细]
  • 非公版RTX 3080显卡的革新与亮点
    本文深入探讨了图形显卡的进化历程,重点介绍了非公版RTX 3080显卡的技术特点和创新设计。 ... [详细]
author-avatar
白宇2502858015
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有