• 大小: 1.31MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-29
  • 语言: C#
  • 标签: c#  画板  

资源简介

用C#写的画板,基本功梦都已实现 。请指教

资源截图

代码片段和文件信息

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 ;



namespace GDI2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            //缓冲作用 防止屏幕乱闪
            InitializeComponent();
            Setstyle(Controlstyles.AllPaintingInWmPaint |
                Controlstyles.UserPaint |
                Controlstyles.OptimizedDoubleBuffer true);
        }
        private Bitmap bitmap = null;
        private bool dragMode = false;
        private  int drawIndex = 1;
        private int curX curY x y diffX diffYxxyy;
        private Graphics    curGraphics;
        private Pen curPen;
        private SolidBrush curBrush;
        private bool ereaseMode = false;
        public bool quxianMode = false;
        private bool duobianMode = false;
        private Point start;
        private Point end aaa;       
        private string filename;
        public Image newimage;

        public  Point[] point= new Point [10];
        public Point[] point1 = new Point[10];

        public int m = 1;//画曲线时用到
        public  int n = 1;//输入文字的位置
        public bool writeMode = false;
        public Point write;//写入点的位置

        public bool endmode = true;
        public int a = 0ef;
        public int b = 0;
        public int c = 0;
        public int d = 0;

        private bool button = false;//判断橡皮是否开始工作


        private void Form1_Load(object sender EventArgs e)
        {
            richTextBox1.Visible = false;
            bitmap = new Bitmap(773 630);
            curGraphics = Graphics.FromImage(bitmap);
            curGraphics.SmoothingMode = SmoothingMode.AntiAlias;
            curGraphics.Clear(this.BackColor );
            label1.Visible = false;
        }
       private void Form1_MouseDown(object sender MouseEventArgs e)
        {
            if (drawIndex == 11)
            {
                if (n > 2)
                {
                    n = 1;
                }
                    point1[n] = new Point(e.X e.Y);
                    n++;
                
            }
            richTextBox1.Visible = false;
            if (endmode == true)
            { 
                end = new Point(e.Xe.Y );
                endmode = false;
            }
            if (m >= 6)
            {
                m = 1;
            }
            if (drawIndex == 10)
            {

                point[m] = new Point(e.X e.Y);
                m++;
            }         
            curX = e.X;
            curY = e.Y;            
            dragMode = true;
            start = new Point(curX curY );        

                    
        }
       
        
        private void Form1_MouseMove(object sender MouseEventArgs e)
        {     
    
           

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        902  2011-05-08 08:50  画板\GDI2.sln

    ..A..H.     16896  2011-05-13 23:10  画板\GDI2.suo

     文件     343260  2011-05-12 21:00  画板\GDI2\Resources\c721d6d351886d6606088b95.jpg

     文件        988  2011-05-13 16:45  画板\GDI2\Resources\喷枪.jpg

     文件        861  2011-05-13 17:06  画板\GDI2\Resources\刷子.jpg

     文件        875  2011-05-13 17:08  画板\GDI2\Resources\铅笔.jpg

     文件        933  2011-05-13 17:10  画板\GDI2\Resources\橡皮.jpg

     文件        850  2011-05-13 17:10  画板\GDI2\Resources\文字.jpg

     文件        869  2011-05-13 17:11  画板\GDI2\Resources\直线.jpg

     文件        890  2011-05-13 17:12  画板\GDI2\Resources\矩形.jpg

     文件        927  2011-05-13 17:13  画板\GDI2\Resources\椭圆.jpg

     文件        839  2011-05-13 17:14  画板\GDI2\Resources\曲线.jpg

     文件        934  2011-05-13 17:14  画板\GDI2\Resources\多边形.jpg

     文件        882  2011-05-13 17:15  画板\GDI2\Resources\填充矩形.jpg

     文件        932  2011-05-13 17:15  画板\GDI2\Resources\填充椭圆.jpg

     文件        988  2011-05-13 16:44  画板\GDI2\Resources\喷枪1.jpg

     文件      10337  2011-05-13 21:47  画板\GDI2\Form1.resx

     文件       4854  2011-05-13 17:18  画板\GDI2\GDI2.csproj

     文件        485  2011-05-08 08:50  画板\GDI2\Program.cs

     文件     394752  2011-05-13 21:47  画板\GDI2\bin\Debug\GDI2.exe

     文件      56832  2011-05-13 21:47  画板\GDI2\bin\Debug\GDI2.pdb

     文件      14328  2011-05-13 22:43  画板\GDI2\bin\Debug\GDI2.vshost.exe

     文件        490  2007-07-21 01:33  画板\GDI2\bin\Debug\GDI2.vshost.exe.manifest

     文件        439  2011-05-13 22:43  画板\GDI2\obj\Debug\GDI2.csproj.FileListAbsolute.txt

     文件      56832  2011-05-13 21:47  画板\GDI2\obj\Debug\GDI2.pdb

     文件     394752  2011-05-13 21:47  画板\GDI2\obj\Debug\GDI2.exe

     文件       3116  2011-05-13 21:47  画板\GDI2\obj\Debug\GDI2.Form1.resources

     文件     358879  2011-05-13 17:18  画板\GDI2\obj\Debug\GDI2.Properties.Resources.resources

     文件       6144  2011-05-13 17:16  画板\GDI2\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件       1441  2011-05-13 21:47  画板\GDI2\obj\Debug\GDI2.csproj.GenerateResource.Cache

............此处省略20个文件信息

评论

共有 条评论