• 大小: 148KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: C#
  • 标签: C#  

资源简介

winform 项目 的 小画笔,,采用了封装,,继承 面向对象

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using Jackeyyang.DrawShap.DrawClass;
using System.Collections;

namespace Jackeyyang.DrawShap
{
    #region 定义枚举
    public enum DrawType
    {
        Xian = 1
        Yuan
        Quxian
        Juxing
        ShixinTuoYuan
        ShixinJuXing
    };

    public enum LineType
    {
        Xixian = 3
        Cuxian = 6
        Tecuxian = 9
    }

    #endregion

    public partial class MainFrom : Form
    {
     
        private DrawType currentType = DrawType.Xian;   // 当前类型:线条
        private Color currentColor = Color.Black; // 当前颜色
        private LineType currentLine = LineType.Xixian;// 当前线条类型

        private Bitmap buffer;//双缓冲区
        private Shape currentShape;  // 当前正在绘制的图形
        List shapes = new List();  // 已经绘制的图形
        bool IsDraw = false;
          

        public MainFrom()
        {
            InitializeComponent();
            this.buffer = new Bitmap(this.drawArea.Width this.drawArea.Height);
            Graphics g = Graphics.FromImage(buffer);
            g.FillRectangle(Brushes.White new Rectangle(0 0 buffer.Width buffer.Height));
            
        }
        private void MainFrom_Load(object sender EventArgs e)
        {
            this.saveFileDialog1.Filter = “Jpg文件|*.jpg|Gif文件|*.gif|Bmp文件|*.bmp“;
        }
        private void MainFrom_Paint(object sender PaintEventArgs e)
        {
            this.DrawShape();
        }

        #region 单击一个按钮,,其余的就弹起
        private void GetPicType(object sender Panel p)
        {
            foreach (Control c in p.Controls)
            {
                if (c is PictureBox)
                {
                    (c as PictureBox).Borderstyle = Borderstyle.None;
                }
            }

            PictureBox pic = sender as PictureBox;
            pic.Borderstyle = Borderstyle.Fixed3D;
        }

        private void GrawType_Click(object sender EventArgs e)
        {
            GetPicType(sender this.panel2);

            int type = int.Parse((sender as PictureBox).Tag.ToString());
            this.currentType = (DrawType)type;
       
        }

        private void LineType_Click(object sender EventArgs e)
        {
            this.GetPicType(sender this.panel3);

            int type = int.Parse((sender as PictureBox).Tag.ToString());
            currentLine = (LineType)type;
    
        }

        private void ColorType_Click(object sender EventArgs e)
        {
            this.GetPicType(sender this.panel1);

            string name = (sender as PictureBox).Tag.ToString();
            currentColor = Color.FromName(name);


        }

        #endregion

        #region 绘图方法
        private void DrawShape()
        {
 

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

     文件      81920  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\DrawShap.exe

     文件      60928  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\DrawShap.pdb

     文件       5632  2005-12-08 14:51  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\DrawShap.vshost.exe

     文件      19740  2008-11-21 12:58  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\Ellipse.jpg

     文件      21129  2008-11-21 12:58  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\Ellipse.psd

     文件      19282  2008-11-21 13:00  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\FillRect.jpg

     文件      19624  2008-11-21 13:00  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\FillRect.psd

     文件       4049  2008-11-26 09:02  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\hh.jpg

     文件      18998  2008-11-21 12:56  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\Line.jpg

     文件      19512  2008-11-21 12:56  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\Line.psd

     文件      19560  2008-11-21 12:57  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\Pen.jpg

     文件      19973  2008-11-21 12:57  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\Pen.psd

     文件      12988  2008-11-21 14:33  WinForm项目:小画笔\绘图\DrawShap\bin\Debug\Red.bmp

     文件        516  2008-11-26 08:25  WinForm项目:小画笔\绘图\DrawShap\DrawClass\DrawCircle.cs

     文件        594  2008-11-26 08:25  WinForm项目:小画笔\绘图\DrawShap\DrawClass\DrawFillEllipse.cs

     文件        609  2008-11-26 08:25  WinForm项目:小画笔\绘图\DrawShap\DrawClass\DrawFillRectangle.cs

     文件        546  2008-11-26 08:02  WinForm项目:小画笔\绘图\DrawShap\DrawClass\DrawLine.cs

     文件       1155  2008-11-26 08:49  WinForm项目:小画笔\绘图\DrawShap\DrawClass\DrawLines.cs

     文件        579  2008-11-26 08:25  WinForm项目:小画笔\绘图\DrawShap\DrawClass\DrawRectangle.cs

     文件       1805  2008-11-26 08:14  WinForm项目:小画笔\绘图\DrawShap\DrawClass\Shape.cs

     文件       3766  2008-11-26 08:38  WinForm项目:小画笔\绘图\DrawShap\DrawShap.csproj

     文件      57618  2008-11-21 13:03  WinForm项目:小画笔\绘图\DrawShap\Form1.resx

     文件      15086  2007-10-12 11:35  WinForm项目:小画笔\绘图\DrawShap\icon.ico

     文件       8588  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\MainFrom.cs

     文件      28428  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\MainFrom.designer.cs

     文件      54486  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\MainFrom.resx

     文件        845  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\obj\Debug\DrawShap.csproj.GenerateResource.Cache

     文件      81920  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\obj\Debug\DrawShap.exe

     文件      60928  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\obj\Debug\DrawShap.pdb

     文件      33616  2008-11-26 09:19  WinForm项目:小画笔\绘图\DrawShap\obj\Debug\Jackeyyang.DrawShap.MainFrom.resources

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

评论

共有 条评论