winform 关于双曲线的动态绘制
来源:互联网 发布:淘宝开店前期准备 编辑:程序博客网 时间:2024/05/01 04:55
任意输入 参数a,b的值,
大量瞄点连线,汇成双曲线。
具体代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
namespace 绘图
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
PointPairList list = new PointPairList();
PointPairList list1 = new PointPairList();
PointPairList list2 = new PointPairList();
PointPairList list3 = new PointPairList();
LineItem myCurve;
LineItem myCurve1;
LineItem myCurve2;
LineItem myCurve3;
private void Form1_Load(object sender, EventArgs e)
{
syszed();
}
int a;
int b;
double m;
private void button1_Click(object sender, EventArgs e)
{
list.Clear();
list1.Clear();
list2.Clear();
list3.Clear();
i = 0;
if (!int.TryParse(textBox1.Text, out a))
{
MessageBox.Show("填写的a的值不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
textBox1.Select();
return;
}
if (!int.TryParse(textBox2.Text, out b))
{
MessageBox.Show("填写的b的值不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
textBox2.Select();
return;
}
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
PointPairList list = new PointPairList();
PointPairList list1 = new PointPairList();
PointPairList list2 = new PointPairList();
PointPairList list3 = new PointPairList();
LineItem myCurve;
LineItem myCurve1;
LineItem myCurve2;
LineItem myCurve3;
private void Form1_Load(object sender, EventArgs e)
{
syszed();
}
int a;
int b;
double m;
private void button1_Click(object sender, EventArgs e)
{
list.Clear();
list1.Clear();
list2.Clear();
list3.Clear();
i = 0;
if (!int.TryParse(textBox1.Text, out a))
{
MessageBox.Show("填写的a的值不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
textBox1.Select();
return;
}
if (!int.TryParse(textBox2.Text, out b))
{
MessageBox.Show("填写的b的值不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
textBox2.Select();
return;
}
m = (a + b) / 2.0;
timer1.Start();
timer1.Start();
}
public void syszed()
{
this.zedGraphControl1.GraphPane.Title.Text = "双曲线图像";//折线图标题
this.zedGraphControl1.GraphPane.XAxis.Title.Text = "X轴值";//X轴标题
this.zedGraphControl1.GraphPane.YAxis.Title.Text = "Y轴值";//Y轴标题
this.zedGraphControl1.GraphPane.YAxis.Title.FontSpec.FontColor = Color.Red;//设置Y轴字体的颜色
this.zedGraphControl1.GraphPane.Title.FontSpec.FontColor = Color.Gray;//设置标题的颜色
this.zedGraphControl1.GraphPane.XAxis.Title.FontSpec.FontColor = Color.GreenYellow;//设置X轴的字体颜色
public void syszed()
{
this.zedGraphControl1.GraphPane.Title.Text = "双曲线图像";//折线图标题
this.zedGraphControl1.GraphPane.XAxis.Title.Text = "X轴值";//X轴标题
this.zedGraphControl1.GraphPane.YAxis.Title.Text = "Y轴值";//Y轴标题
this.zedGraphControl1.GraphPane.YAxis.Title.FontSpec.FontColor = Color.Red;//设置Y轴字体的颜色
this.zedGraphControl1.GraphPane.Title.FontSpec.FontColor = Color.Gray;//设置标题的颜色
this.zedGraphControl1.GraphPane.XAxis.Title.FontSpec.FontColor = Color.GreenYellow;//设置X轴的字体颜色
myCurve = zedGraphControl1.GraphPane.AddCurve("", list, Color.Red, SymbolType.Diamond);
myCurve.Symbol.Fill = new Fill(Color.Red, Color.Red, Color.Red);//
myCurve1 = zedGraphControl1.GraphPane.AddCurve("", list1, Color.Red, SymbolType.Diamond);
myCurve1.Symbol.Fill = new Fill(Color.Red, Color.Red, Color.Red);//
myCurve2 = zedGraphControl1.GraphPane.AddCurve("", list2, Color.Red, SymbolType.Diamond);
myCurve2.Symbol.Fill = new Fill(Color.Red, Color.Red, Color.Red);//
myCurve3 = zedGraphControl1.GraphPane.AddCurve("", list3, Color.Red, SymbolType.Diamond);
myCurve3.Symbol.Fill = new Fill(Color.Red, Color.Red, Color.Red);//
this.zedGraphControl1.AxisChange();
this.zedGraphControl1.Refresh();
}
int i = 0;
double x;
double f;
private void timer1_Tick(object sender, EventArgs e)
{
this.zedGraphControl1.AxisChange();
int i = 0;
double x;
double f;
private void timer1_Tick(object sender, EventArgs e)
{
this.zedGraphControl1.AxisChange();
this.zedGraphControl1.Refresh();
x = a + i * 0.01; f = 0 - x;
double y = Math.Sqrt((b * b * x * x * 1.0 / a) / a - b * b);
list.Add(x, y); list2.Add(f, y);
y = 0-Math.Sqrt((b * b * x * x * 1.0 / a) / a - b * b);
list1.Add(f, y);
list3.Add(x, y);
i++;
if (list.Count > 10000)
{
x = a + i * 0.01; f = 0 - x;
double y = Math.Sqrt((b * b * x * x * 1.0 / a) / a - b * b);
list.Add(x, y); list2.Add(f, y);
y = 0-Math.Sqrt((b * b * x * x * 1.0 / a) / a - b * b);
list1.Add(f, y);
list3.Add(x, y);
i++;
if (list.Count > 10000)
{
list.RemoveAt(0);
}
}
}
}
}
}
下面这两幅图是在实时绘制过程截取两张图片,可以使研究者直观观察出函数变化趋势。
0 0
- winform 关于双曲线的动态绘制
- 绘制双曲线view
- C# GDI+绘制双曲线
- C# Winform绘制动态曲线
- 双曲线
- 如何通过几何画板绘制双曲线
- Winform的Panel绘制边框
- 数值分析基础工具使用Matlab绘制双曲线
- WINFORM树结构的绘制和数据表结构的绘制。
- C# Winform中绘制动画的方法
- 在winform中绘制矩形的方法
- C# winform绘制条形统计图的例子
- 绘制平滑线条的winform窗体
- WinForm下波形图的绘制
- Winform 界面的动态翻译
- 动态绘制图形的基本思路
- Android 绘制动态的曲线图
- FusionChart动态报表的绘制
- 几何总论
- 增加 ModelAndView 配置
- C++11的占位符std::placeholders
- JAVA初学者必备的连库类
- The specified child already has a parent. You must call removeView
- winform 关于双曲线的动态绘制
- 8 种 NoSQL 数据库系统对比
- HDOJ-----1069Monkey and Banana
- 如何在Win7安装MongoDB服务
- 个人知识管理最常见的误区有哪些?
- Libcurl 从FTP服务器下载
- Qt之自定义控件(开关按钮)
- JSP Session
- UVA 11462Age Sort