求画图程序 只要能画曲线就可以 各位大侠 谁能给我一个用c#编的画图函数程序 只要能画曲线就可以拉 大家帮忙啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 写了个很简单的,楼主参考一下;public void DrawLine() { Graphics g = this.CreateGraphics(); Pen redPen = new Pen (Color.Red ); Point[] poins = new Point [] {new Point (0,0),new Point (50,50),new Point (200,150)}; //把点输进来就可以了 g.DrawLines(redPen, poins); } 感谢上面这个高手的函数 不过我想要个这样的 public void DrawCurve(Pen pen,Point[] points)可以直接引用的 我还想就是编译一个函数可以确定画线的坐标 不是固定的 就是画图的那种画到哪里就是哪里 //成员Graphics g;int oldX = 0;int oldY = 0;//g = this.CreateGraphics();//在鼠标移动事件中private void MsMove(object sender, System.Windows.Forms.MouseEventArgs e){ g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y); oldX = e.X; oldY = e.Y;} private void MsMove(object sender, System.Windows.Forms.MouseEventArgs e){ g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y); oldX = e.X; oldY = e.Y;}好象这个函数没有起作用啊不好意思啊 我是刚开始学习应用阶段 菜鸟一个 请大家多多指教 我直接将这个函数贴在代码里了 可是怎么没有起作用呢 不过我想要个这样的 public void DrawCurve(Pen pen,Point[] points)可以直接引用的 ------------------------------------------------------------------那不是更简单?public void DrawCurve(Pen pen,Point[] points ) { Graphics g = this.CreateGraphics(); g.DrawLines(pen, poins); } //鼠标移动就是画线了。using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;namespace DrawTest{ /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; //成员 Graphics g; int oldX = 0; int oldY = 0; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // g = this.CreateGraphics(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 266); this.Name = "Form1"; this.Text = "Form1"; this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MsMove); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } //在鼠标移动事件中 private void MsMove(object sender, System.Windows.Forms.MouseEventArgs e) { g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y); oldX = e.X; oldY = e.Y; } }} //鼠标按下才开始画线的例子using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;namespace DrawTest{ /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; //成员 Graphics g; bool Drag=false; int oldX = 0; int oldY = 0; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // g = this.CreateGraphics(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 266); this.Name = "Form1"; this.Text = "Form1"; this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MsDown); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MsUp); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MsMove); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } //在鼠标移动事件中 private void MsMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (Drag) { g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y); oldX = e.X; oldY = e.Y; } } private void MsDown(object sender, System.Windows.Forms.MouseEventArgs e) { Drag = true; oldX=e.X; oldY=e.Y; } private void MsUp(object sender, System.Windows.Forms.MouseEventArgs e) { Drag = false; } }} 建议使用矢量图形组件TCADhttp://www.codeidea.com/cn/ 帮忙分析个模拟POST,版主,求助啊 又来C#读取INI问题 技术难点!!!!!!!!!!! 有人用过WorkQueue吗??如何暂停一个进程池??我暂停不了。。。 C# 创建了一个iis站点,无法使用运行asp或aspx,up有分 不耻下问,关于#include的问题! [求助]请教一个关于打印格式的问题! 求救:从html触发后台按钮后的操作bug? 求助! 请问各位out string做参数为什么会崩溃,谢谢 准备开发一个甘特图控件,其中的进度条需要能够拖动。进度条部分用label,还是画图作好呢!!!!! 怎样用C#调用visio编程接口画类图
public void DrawLine()
{
Graphics g = this.CreateGraphics();
Pen redPen = new Pen (Color.Red );
Point[] poins = new Point [] {new Point (0,0),new Point (50,50),new Point (200,150)}; //把点输进来就可以了
g.DrawLines(redPen, poins); }
public void DrawCurve(Pen pen,Point[] points)
可以直接引用的
我还想就是编译一个函数可以确定画线的坐标 不是固定的 就是画图的那种画到哪里就是哪里
Graphics g;
int oldX = 0;
int oldY = 0;//
g = this.CreateGraphics();
//在鼠标移动事件中
private void MsMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y);
oldX = e.X;
oldY = e.Y;
}
{
g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y);
oldX = e.X;
oldY = e.Y;
}
好象这个函数没有起作用啊
不好意思啊 我是刚开始学习应用阶段 菜鸟一个 请大家多多指教 我直接将这个函数贴在代码里了 可是怎么没有起作用呢
public void DrawCurve(Pen pen,Point[] points)
可以直接引用的
------------------------------------------------------------------
那不是更简单?
public void DrawCurve(Pen pen,Point[] points )
{
Graphics g = this.CreateGraphics();
g.DrawLines(pen, poins); }
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace DrawTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
//成员
Graphics g;
int oldX = 0;
int oldY = 0; public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent(); //
// TODO: Add any constructor code after InitializeComponent call
//
g = this.CreateGraphics();
} /// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MsMove); }
#endregion /// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} //在鼠标移动事件中
private void MsMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y);
oldX = e.X;
oldY = e.Y;
} }
}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace DrawTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
//成员
Graphics g;
bool Drag=false;
int oldX = 0;
int oldY = 0; public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent(); //
// TODO: Add any constructor code after InitializeComponent call
//
g = this.CreateGraphics();
} /// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MsDown);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MsUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MsMove); }
#endregion /// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} //在鼠标移动事件中
private void MsMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (Drag)
{
g.DrawLine(new Pen(Color.Red), oldX, oldY, e.X, e.Y);
oldX = e.X;
oldY = e.Y;
}
} private void MsDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
Drag = true;
oldX=e.X;
oldY=e.Y;
} private void MsUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
Drag = false;
} }
}
http://www.codeidea.com/cn/