资源简介
三角形网格绘制等值线,不同的等值线用不同颜色的线条绘制,程序提供了查看等值线生成路径的功能,便于大家学习;开发环境VS2008,开发语言C#;

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MyContour
{
public partial class frmMain : Form
{
#region 属性
public static bool showPoint = false;
public static bool drawLines = true;
private float[] _Data;
///
/// 等值线原始格点数据
///
public float[] Data
{
get { return _Data; }
set { _Data = value; }
}
private float[] _ContourValues;
///
/// 等值线值数组
///
public float[] ContourValues
{
get { return _ContourValues; }
set { _ContourValues = value; }
}
#endregion
#region 窗体所有操作
public frmMain()
{
InitializeComponent();
MakeTestData();
setColor();
gg = pictureBox1.CreateGraphics();
}
private void button1_Click(object sender EventArgs e)
{
this.timer1.Enabled = false;
initValue(); //重新初始化绘制路径的数组
MakeTestData();
pictureBox1.Refresh();
}
private void pictureBox1_Paint(object sender PaintEventArgs e)
{
if (this.Data == null) return;
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
Pen pen = new Pen(Color.DarkGray 1);
//绘制等值线
if (drawLines)
{
this.plotContour(e.Graphics pictureBox1.Size);
}
//绘制网格
if (frmMain.showPoint)
{
int ww = pictureBox1.Width / (Data.GetLength(0) - 1); //x轴间隔长度
int yy = pictureBox1.Height / (Data.GetLength(1) - 1);//y轴间隔长度
//绘制网格横竖线
for (int p = 0; p < Data.GetLength(0); p++)
{
e.Graphics.DrawLine(pen new Point(p * ww 0) new Point((p) * ww pictureBox1.Height));
}
for (int k = 0; k < Data.GetLength(1); k++)
{
e.Graphics.DrawLine(pen new Point(0 k * yy) new Point(pictureBox1.Width k * yy));
}
//绘制网格斜线
for (int j = 0; j < Data.GetLength(0) - 1; j++)
{
for (int i = 1; i < Data.GetLength(1); i++)
{
e.Graphics.DrawLine(pen new Point(j * ww (i - 1) * yy) new Point((j + 1) * ww i * yy));
e.Graphics.DrawLine(pen new Point(j * ww i * yy) new Point((j + 1) * ww (i - 1) * yy));
}
}
//绘制格点值
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 28672 2011-11-28 14:13 MyContour\bin\Debug\Interop.ViContour1.dll
文件 16896 2011-11-28 16:27 MyContour\bin\Debug\MyContour.exe
文件 32256 2011-11-28 16:27 MyContour\bin\Debug\MyContour.pdb
文件 14328 2011-11-28 16:27 MyContour\bin\Debug\MyContour.vshost.exe
文件 3092480 2011-11-28 15:59 MyContour\bin\Debug\TeeChart.dll
文件 126976 2001-10-10 14:02 MyContour\bin\Debug\ViContImg45.dll
文件 94208 2001-12-02 18:02 MyContour\bin\Debug\ViContour45.dll
文件 110592 2006-01-27 12:59 MyContour\bin\Debug\ViContour45.ocx
文件 14315 2011-11-28 16:27 MyContour\Form1.cs
文件 7448 2011-11-28 16:27 MyContour\Form1.Designer.cs
文件 6008 2011-11-28 16:27 MyContour\Form1.resx
文件 7203 2011-11-28 16:27 MyContour\MyContour.csproj
文件 907 2011-11-21 13:57 MyContour\MyContour.sln
..A..H. 33792 2011-11-28 16:27 MyContour\MyContour.suo
文件 28672 2011-11-28 14:13 MyContour\obj\Debug\Interop.ViContour1.dll
文件 1124 2011-11-28 16:27 MyContour\obj\Debug\MyContour.csproj.FileListAbsolute.txt
文件 905 2011-11-28 16:27 MyContour\obj\Debug\MyContour.csproj.GenerateResource.Cache
文件 589 2011-11-28 14:13 MyContour\obj\Debug\MyContour.csproj.ResolveComReference.cache
文件 16896 2011-11-28 16:27 MyContour\obj\Debug\MyContour.exe
文件 540 2011-11-28 16:27 MyContour\obj\Debug\mycontour.exe.licenses
文件 180 2011-11-28 16:27 MyContour\obj\Debug\MyContour.frmMain.resources
文件 32256 2011-11-28 16:27 MyContour\obj\Debug\MyContour.pdb
文件 180 2011-11-28 16:27 MyContour\obj\Debug\MyContour.Properties.Resources.resources
文件 133965 2011-11-28 16:22 MyContour\obj\Debug\ResolveAssemblyReference.cache
文件 4608 2011-11-21 13:15 MyContour\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 508 2009-06-01 00:07 MyContour\obj\MyContour.csproj.FileListAbsolute.txt
文件 470 2009-05-31 22:55 MyContour\Program.cs
文件 1176 2009-05-30 22:50 MyContour\Properties\AssemblyInfo.cs
文件 695 2011-11-28 15:12 MyContour\Properties\licenses.licx
文件 2842 2011-11-21 13:14 MyContour\Properties\Resources.Designer.cs
............此处省略14个文件信息
相关资源
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论