资源简介

C#编写的 实现了 选择图元 移动图元 旋转图元 保存bmp 注意要按着鼠标不放(保持选择图元)后 按A或S才能旋转图元

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Text;
using System.Windows.Forms;

namespace Drawing
{
    public partial class drawbox : Form
    {
        /// 
        /// int type Color scolor
        /// 

        private  int type;
        public int Type
        {
            get
            {
                return type;
            }
            set
            {
                type = value;
            }
        }
        private Color scolor;
        public Color Scolor
        {
            get
            {
                return scolor;
            }
            set
            {
                scolor =value ;
            }
        }
        public bool select = false;

        /// 
        /// 
        /// 

        private  Point beginPoint;
        private  Point endPoint;
        private  Shape ashape;
        private  bool begin = false;
        List myshape = new List();

        private Point mousepoint;

        private bool drawsize = false;
        /// 
        /// 
        /// 

        public drawbox()
        {
            InitializeComponent();
            Setstyle(Controlstyles.UserPaint true);
            Setstyle(Controlstyles.AllPaintingInWmPaint true);
            Setstyle(Controlstyles.DoubleBuffer true);
        }

        private void drawbox_MouseMove(object sender MouseEventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.SmoothingMode = SmoothingMode.AntiAlias;
            if (begin)
            {  
                this.Refresh();
                endPoint = new Point(e.X e.Y);
                ashape = new Shape(type scolor beginPoint endPoint);
                ashape.drawShape(g);
            }
            if (begin&&e.X > this.Width || e.X < 0 || e.Y < 0 || e.Y > this.Height)
            {
                begin = false;
                this.Refresh();
            }

            if (select)
            {
                for (int i = myshape.Count - 1; i >= 0; i--)
                {
                    if (myshape[i].selected == true)
                    {
                        if (myshape[i].rotate != 0)
                        {
                            g.TranslateTransform(myshape[i].midPoint.X myshape[i].midPoint.Y);
                            g.RotateTransform(myshape[i].rotate);
                            g.TranslateTransform(-myshape[i].midPoint.X -myshape[i].midPoint.Y);
                        }
                        
                        this.Refresh();
                        myshape[i].Bpoint = new Point(myshape[i].Bpoint.X + e.X - mousepoint.X myshape[i].Bpoint.Y + e.Y - mousepoint.Y);
                        myshape[i].Epoint = new Po

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

     文件       5612  2008-05-27 19:32  Drawing\Drawing\Properties\Resources.resx

     文件        249  2008-05-27 19:32  Drawing\Drawing\Properties\Settings.settings

     文件       1186  2008-05-27 19:32  Drawing\Drawing\Properties\AssemblyInfo.cs

     文件       2870  2008-05-27 19:32  Drawing\Drawing\Properties\Resources.Designer.cs

     文件       1092  2008-05-27 19:32  Drawing\Drawing\Properties\Settings.Designer.cs

     文件       9752  2008-06-02 23:47  Drawing\Drawing\drawbox.cs

     文件       2171  2008-06-02 23:24  Drawing\Drawing\drawbox.Designer.cs

     文件      30666  2008-06-04 01:01  Drawing\Drawing\mainForm.Designer.cs

     文件       5814  2008-06-02 23:24  Drawing\Drawing\drawbox.resx

     文件      10134  2008-06-04 01:01  Drawing\Drawing\38.ico

     文件      16384  2008-05-27 19:49  Drawing\Drawing\bin\Debug\mylabel.dll

     文件      13824  2008-05-27 19:49  Drawing\Drawing\bin\Debug\mylabel.pdb

     文件      61440  2008-06-04 01:01  Drawing\Drawing\bin\Debug\Drawing.exe

     文件      56832  2008-06-04 01:01  Drawing\Drawing\bin\Debug\Drawing.pdb

     文件      56832  2008-06-04 01:01  Drawing\Drawing\obj\Debug\Drawing.pdb

     文件      12465  2008-06-04 01:01  Drawing\Drawing\obj\Debug\Drawing.mainForm.resources

     文件        180  2008-05-27 19:52  Drawing\Drawing\obj\Debug\Drawing.Properties.Resources.resources

     文件       1026  2008-06-04 01:01  Drawing\Drawing\obj\Debug\Drawing.csproj.GenerateResource.Cache

     文件      61440  2008-06-04 01:01  Drawing\Drawing\obj\Debug\Drawing.exe

     文件       7416  2008-05-27 22:10  Drawing\Drawing\obj\Debug\ResolveAssemblyReference.cache

     文件        180  2008-06-02 23:24  Drawing\Drawing\obj\Debug\Drawing.drawbox.resources

     文件        931  2008-06-04 01:02  Drawing\Drawing\obj\Drawing.csproj.FileListAbsolute.txt

     文件       3693  2008-06-04 00:21  Drawing\Drawing\Shape.cs

     文件       8418  2008-06-04 01:01  Drawing\Drawing\mainForm.cs

     文件      23683  2008-06-04 01:01  Drawing\Drawing\mainForm.resx

     文件       7358  2008-06-02 23:35  Drawing\Drawing\OPENSTEP_EUI Bitmap Image.ico

     文件        536  2008-06-02 23:35  Drawing\Drawing\Drawing.csproj.user

     文件        469  2008-05-27 19:33  Drawing\Drawing\Program.cs

     文件       4032  2008-06-04 01:01  Drawing\Drawing\Drawing.csproj

     文件        910  2008-05-27 19:32  Drawing\Drawing.sln

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

评论

共有 条评论

相关资源