• 大小: 73KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-23
  • 语言: 其他
  • 标签: 板绘图  

资源简介

设计一个手写板绘图程序,获取用户在手写板上的输入位置和压力信息,获取基本笔画。

资源截图

代码片段和文件信息

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;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        Bitmap bitmap;
        public Form1()
        {
            InitializeComponent();
        }
        int x y;
        public bool bl = false;
        int width = 2;
        Color selectcolor = Color.Black;
        Graphics g;
        private void Form1_Paint(object sender PaintEventArgs e)
        {
        }  

        public void  button1_Click(object sender EventArgs e)//调用系统自带的颜色对话框
        {
            if (this.colorDialog1.ShowDialog() == DialogResult.OK)
            {
                selectcolor = colorDialog1.Color;
            }
        }


        private void button3_Click(object sender EventArgs e)//清除画板
        {
            bitmap.Dispose();
            Bitmap bitmap1 = new Bitmap(pictureBox1.Width pictureBox1.Height);
            bitmap = bitmap1;
           // g.Clear(Color.White);
        }

        private void button4_Click(object sender EventArgs e) //保存图象  
        {
           bitmap.Save (“D:\\a.bmp “);
           MessageBox.Show(“保存成功“);
        
        }

        private void Form1_Load(object sender EventArgs e)
        {
            bitmap = new Bitmap(pictureBox1.Width pictureBox1.Height);
        }

        private void pictureBox1_MouseMove_1(object sender MouseEventArgs e)//开始画图
        {
            Point PtEnd = new Point(e.X e.Y);
            Point PtStart = new Point(x y);
            Pen pen = new Pen(selectcolor width);
            if (bl == true)
            {
                g = Graphics.FromImage(bitmap);
                g.DrawLine(pen PtStart PtEnd);
                g.Dispose();
             
            }
            this.pictureBox1.Image = bitmap;
            x = e.X;
            y = e.Y;
        }

        private void pictureBox1_MouseDown_1(object sender MouseEventArgs e)
        {
            x = e.X;
            y = e.Y;
            bl = true;
        }

        private void pictureBox1_MouseUp_1(object sender MouseEventArgs e)
        {
            bl = false;
        }

        private void numericUpDown1_ValueChanged(object sender EventArgs e)
        {
            width = (int)numericUpDown1.Value;
        }

    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\Backup\
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\Backup\WindowsFormsApplication1\
     文件         962  2011-10-27 18:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1.sln
     文件       18944  2011-11-19 14:11  WindowsFormsApplication1\Backup\WindowsFormsApplication1.suo
     文件        2550  2011-11-19 13:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Form1.cs
     文件        6982  2011-11-18 08:29  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Form1.Designer.cs
     文件        6014  2011-11-18 08:29  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Form1.resx
     文件         505  2011-10-27 18:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Program.cs
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Properties\
     文件        1404  2011-10-27 18:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Properties\AssemblyInfo.cs
     文件        2898  2011-10-27 18:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Properties\Resources.Designer.cs
     文件        5612  2011-10-27 18:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Properties\Resources.resx
     文件        1109  2011-10-27 18:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Properties\Settings.Designer.cs
     文件         249  2011-10-27 18:30  WindowsFormsApplication1\Backup\WindowsFormsApplication1\Properties\Settings.settings
     文件        3759  2011-10-27 18:53  WindowsFormsApplication1\Backup\WindowsFormsApplication1\WindowsFormsApplication1.csproj
     文件        4544  2013-04-02 19:09  WindowsFormsApplication1\UpgradeLog.xml
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\WindowsFormsApplication1\
     文件         962  2013-04-02 19:09  WindowsFormsApplication1\WindowsFormsApplication1.sln
     文件       23040  2013-04-02 19:36  WindowsFormsApplication1\WindowsFormsApplication1.suo
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\WindowsFormsApplication1\bin\
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\
     文件       10240  2013-04-02 19:20  WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
     文件       34304  2013-04-02 19:20  WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
     文件       11608  2013-04-02 19:36  WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
     文件         490  2010-03-17 22:39  WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
     目录           0  2013-04-02 19:09  WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\
     文件        2194  2013-04-02 19:19  WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs
     文件        4510  2013-04-02 19:19  WindowsFormsApplication1\WindowsFormsApplication1\Form1.Designer.cs
     文件        6014  2013-04-02 19:19  WindowsFormsApplication1\WindowsFormsApplication1\Form1.resx
     目录           0  2013-05-31 18:42  WindowsFormsApplication1\WindowsFormsApplication1\obj\
............此处省略25个文件信息

评论

共有 条评论

相关资源