C#在Windows窗体中怎样实现手写功能
3个回答
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication67
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Point[] p=new Point[0];
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
Array.Resize(ref p, p.Length + 1);
p[p.GetUpperBound(0)] = new Point(e.X, e.Y);
if (e.Button == MouseButtons.Left && p.Length > 1)
{
Graphics g = pictureBox1.CreateGraphics();
g.DrawLine(Pens.Red, p[p.GetUpperBound(0)], p[p.GetUpperBound(0)-1]);
}
}
}
}
//在picturebox控件中实现手写!
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication67
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Point[] p=new Point[0];
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
Array.Resize(ref p, p.Length + 1);
p[p.GetUpperBound(0)] = new Point(e.X, e.Y);
if (e.Button == MouseButtons.Left && p.Length > 1)
{
Graphics g = pictureBox1.CreateGraphics();
g.DrawLine(Pens.Red, p[p.GetUpperBound(0)], p[p.GetUpperBound(0)-1]);
}
}
}
}
//在picturebox控件中实现手写!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询