资源简介
利用C#语言实现MSChart控件中图形拖拽功能的winForm程序

代码片段和文件信息
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 System.Drawing.Drawing2D;
using System.Collections;//Arraylist类
using System.Windows.Forms.DataVisualization.Charting;//ChartAreaSeries
namespace CGraphs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e)
{
int[] points1 = new int[] { { 1 1 } { 2 5 } { 3 2 } { 4 9 } { 5 3 } };
for (int i = 0; i < 5; i++)
{
chart1.Series[0].Points.AddXY(points1[i0]points1[i1]);
chart1.Series[0].Tag = 11;
}
chart1.Series[0].Name = “Series11“;
int[] points2 = new int[] { { 1 3 } { 2 10 } { 3 2 } { 4 6 } { 5 0 } };
for (int j = 0; j < 5; j++)
{
chart2.Series[0].Points.AddXY(points2[j 0] points2[j 1]);
chart2.Series[0].Tag = 21;
}
chart2.Series[0].Name = “Series21“;
int[] xp = new int[] { 1 2 3 4 5 };
int[] yp = new int[] { 3 9 2 5 1 };
chart1.Series.Add(“Series12“);
chart1.Series[“Series12“].Tag = 12;
chart1.Series[“Series12“].Points.DataBindXY(xp yp);
chart1.Series[“Series12“].ChartType = SeriesChartType.Line;//设置图表类型:线、柱、饼
this.UnDo.Enabled = false;
}
private void chart1_DragLeave(object sender EventArgs e)
{
//ArrayList points = new ArrayList();
//points.Add(chart1.Series.Count);
//MessageBox.Show(chart1.Series.Count.ToString());
}
private void chart1_MouseDown(object sender MouseEventArgs e)
{
MyChart mc = new MyChart();
foreach (System.Windows.Forms.DataVisualization.Charting.Series ser in chart1.Series)//通过遍历取出chart中所有曲线
{
MySerie ms = new MySerie();
for (int i = 0; i < chart1.Series[ser.Name].Points.Count; i++)
{
MyPoint mp = new MyPoint();
mp.XValue = chart1.Series[ser.Name].Points[i].XValue;
mp.YValue = chart1.Series[ser.Name].Points[i].YValues[0];
ms.myseriePoint.Add(mp);
}
ms.SeriesID = (int)chart1.Series[ser.Name].Tag;
mc.mySerie.Add(ms);
}
this.chart1.DoDragDrop(mc DragDropEffects.Copy);
}
private void chart2_DragEnter(object sender DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void chart2_DragDrop(object sender DragEventAr
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-03-31 16:22 CGraphs\
目录 0 2014-04-02 20:07 CGraphs\CGraphs\
文件 5699 2014-04-02 20:07 CGraphs\CGraphs\CGraphs.csproj
文件 452 2014-04-02 20:07 CGraphs\CGraphs\CGraphs.csproj.user
文件 9363 2014-04-04 17:58 CGraphs\CGraphs\Form1.Designer.cs
文件 7175 2014-04-04 18:15 CGraphs\CGraphs\Form1.cs
文件 6015 2014-04-04 17:58 CGraphs\CGraphs\Form1.resx
文件 2278 2014-04-04 17:51 CGraphs\CGraphs\FormTip.Designer.cs
文件 361 2014-04-04 17:51 CGraphs\CGraphs\FormTip.cs
文件 5817 2014-04-04 17:51 CGraphs\CGraphs\FormTip.resx
文件 488 2014-03-31 16:22 CGraphs\CGraphs\Program.cs
目录 0 2014-03-31 16:22 CGraphs\CGraphs\Properties\
文件 1346 2014-03-31 16:22 CGraphs\CGraphs\Properties\AssemblyInfo.cs
文件 2865 2014-03-31 16:22 CGraphs\CGraphs\Properties\Resources.Designer.cs
文件 5612 2014-03-31 16:22 CGraphs\CGraphs\Properties\Resources.resx
文件 1093 2014-03-31 16:22 CGraphs\CGraphs\Properties\Settings.Designer.cs
文件 249 2014-03-31 16:22 CGraphs\CGraphs\Properties\Settings.settings
目录 0 2014-03-31 16:22 CGraphs\CGraphs\bin\
目录 0 2014-03-31 16:29 CGraphs\CGraphs\bin\Debug\
文件 16384 2014-04-04 18:15 CGraphs\CGraphs\bin\Debug\CGraphs.exe
文件 38400 2014-04-04 18:15 CGraphs\CGraphs\bin\Debug\CGraphs.pdb
文件 11600 2014-04-04 18:15 CGraphs\CGraphs\bin\Debug\CGraphs.vshost.exe
文件 490 2010-03-17 22:39 CGraphs\CGraphs\bin\Debug\CGraphs.vshost.exe.manifest
目录 0 2014-03-31 16:22 CGraphs\CGraphs\obj\
目录 0 2014-03-31 16:22 CGraphs\CGraphs\obj\x86\
目录 0 2014-04-04 18:15 CGraphs\CGraphs\obj\x86\Debug\
文件 180 2014-04-04 17:58 CGraphs\CGraphs\obj\x86\Debug\CGraphs.Form1.resources
文件 180 2014-04-04 17:51 CGraphs\CGraphs\obj\x86\Debug\CGraphs.FormTip.resources
文件 180 2014-04-02 20:07 CGraphs\CGraphs\obj\x86\Debug\CGraphs.Properties.Resources.resources
文件 709 2014-04-04 18:15 CGraphs\CGraphs\obj\x86\Debug\CGraphs.csproj.FileListAbsolute.txt
文件 16384 2014-04-04 18:15 CGraphs\CGraphs\obj\x86\Debug\CGraphs.exe
............此处省略9个文件信息
相关资源
- 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#版保龄球记分代码
- C#自定义控件
评论
共有 条评论