winform 绘制sin函数图像 winformsin函数图像返回坐标值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己找一段绘图的代码研究,就是根据你绘图区域,把值转换为区域内坐标,先取出数据中的最大值和最小值,然后根据这两个值以及绘图区域的bottom和top算比例, 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;namespace WaveImage{ public partial class Frm_Main : Form { public Frm_Main() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Graphics graphics = this.CreateGraphics(); //实例化窗体的Graphics类 Pen myPen = new Pen(Color.Black, 1); //设置画笔 int beginX = 50; //定义变量 int beginY = 65; int height = 35; int width = 50; Point pointX1 = new Point(beginX, beginY); Point pointY1 = new Point(beginX + 210, beginY); Point pointX2 = new Point(beginX, beginY - 45); Point pointY2 = new Point(beginX, beginY + 45); //调用DrawLine方法绘制两条垂直相交的直线,用来作为波形图的横纵坐标 graphics.DrawLine(myPen, pointX1, pointY1); graphics.DrawLine(myPen, pointX2, pointY2); graphics.DrawBezier(myPen, beginX, beginY, beginX + 15, beginY - height, beginX + 40, beginY - height, beginX + width, beginY); //绘制上半区域交错连接的贝塞尔曲线 graphics.DrawBezier(myPen, beginX + width, beginY, beginX + width + 15, beginY + height, beginX + width + 40, beginY + height, beginX + width * 2, beginY); //绘制下半区域交错连接的贝塞尔曲线 graphics.DrawBezier(myPen, beginX + width * 2, beginY, beginX + width * 2 + 15, beginY - height, beginX + width * 2 + 40, beginY - height, beginX + width * 3, beginY); //绘制上半区域交错连接的贝塞尔曲线 graphics.DrawBezier(myPen, beginX + width * 3, beginY, beginX + width * 3 + 15, beginY + height, beginX + width * 3 + 40, beginY + height, beginX + width * 4, beginY); //绘制下半区域交错连接的贝塞尔曲线 } }} 已完美画出sin函数图,但是可不可以使它在winform中返回多个sin函数的坐标点,使这些坐标点连接形成sin函数图像? http://blog.csdn.net/xianfajushi/article/details/7493697 如果是在WinForm下,你得学习一下GDI+。百度一下,博客园上有专门关于GDI+的教程。数学上实现并不是很难。 MDI子窗体标题的问题 wpf 图片的问题 winform中的textbox可以输入的字符串长度是不是有限制?能够调整为无限长,或者用其它的控件? DataGrid的ItemCommand和OnPageIndexChanged XML遍歷問題﹖ 再问正则表达式操作INI问题,高分!!! 与数据库相连的有关问题 急招-C#软件工程师 500分 求Salamander .NET Decompiler 正式版 谁能说一下DOTNET和JAVA比,好处都在那里???? 如何用c#调整EXCEL单元格的宽度 winform 在64位系统上无法正常的运行
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;namespace WaveImage
{
public partial class Frm_Main : Form
{
public Frm_Main()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
Graphics graphics = this.CreateGraphics(); //实例化窗体的Graphics类
Pen myPen = new Pen(Color.Black, 1); //设置画笔
int beginX = 50; //定义变量
int beginY = 65;
int height = 35;
int width = 50;
Point pointX1 = new Point(beginX, beginY);
Point pointY1 = new Point(beginX + 210, beginY);
Point pointX2 = new Point(beginX, beginY - 45);
Point pointY2 = new Point(beginX, beginY + 45);
//调用DrawLine方法绘制两条垂直相交的直线,用来作为波形图的横纵坐标
graphics.DrawLine(myPen, pointX1, pointY1);
graphics.DrawLine(myPen, pointX2, pointY2);
graphics.DrawBezier(myPen, beginX, beginY, beginX + 15, beginY - height, beginX + 40, beginY - height, beginX + width,
beginY); //绘制上半区域交错连接的贝塞尔曲线
graphics.DrawBezier(myPen, beginX + width, beginY, beginX + width + 15, beginY + height, beginX + width + 40,
beginY + height, beginX + width * 2, beginY); //绘制下半区域交错连接的贝塞尔曲线
graphics.DrawBezier(myPen, beginX + width * 2, beginY, beginX + width * 2 + 15, beginY - height, beginX + width * 2
+ 40, beginY - height, beginX + width * 3, beginY); //绘制上半区域交错连接的贝塞尔曲线
graphics.DrawBezier(myPen, beginX + width * 3, beginY, beginX + width * 3 + 15, beginY + height, beginX + width * 3
+ 40, beginY + height, beginX + width * 4, beginY); //绘制下半区域交错连接的贝塞尔曲线
}
}
}
数学上实现并不是很难。