日期:2014-05-17 浏览次数:20973 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;
using System.Windows.Forms;
namespace frmSxqm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Graphics g;
private int sX, sY;
private Bitmap bitmap;
private void Form1_Load(object sender, EventArgs e)
{
bitmap = new Bitmap(300, 300);
g = Graphics.FromImage(bitmap);
Cursor.Current = Cursors.Default;
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
sX = e.X;
sY = e.Y;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
g.DrawLine(new Pen(Color.Black, 3), sX, sY, e.X, e.Y);
sX = e.X; sY = e.Y;
this.pictureBox1.Image = bitmap;
}
private void button1_Click(object sender, EventArgs e)
{
bitmap = new Bitmap(300, 300);
g = Graphics.FromImage(bitmap);
this.pictureBox1.Image = bitmap;
}
private void button2_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("确定签名完成了吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
&nbs