资源简介

基于GDI+的图元绘制拾取 C#实现 程序效果如博客http://blog.csdn.net/small_fish__/article/details/7394304所见

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace DrawmetaGraph
{
    class Circle : metaTypeGraph
    {

        private Graphics graphics;
        private int radius;

        //构造方法
        public Circle(Graphics graphics Point upLeftCoordinate)
        {
            this.fillColor = Color.Red;      //默认填充色
            this.radius = 25;
            this.graphics = graphics;
            this.upLeftCoordinate = upLeftCoordinate;
            
        }

        //重写的鼠标点击事件响应
        public override void MouseDown(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                isSelected = inSidePolygon(new Point(e.X e.Y));
            }
            else
            {
                isSelected = false;
            }
            draw();

        }

        //判断鼠标是否选中图元
        private bool inSidePolygon(Point p)
        {
            int dx = p.X - (upLeftCoordinate.X + radius);
            int dy = p.Y - (upLeftCoordinate.Y + radius);
            if ((dx*dx + dy*dy) < radius*radius )
                return true;
            else
                return false;
        }

        //重写绘画的方法
        public override void draw()
        {
            if (isSelected == true)
            {
                graphics.FillPie(new SolidBrush(choosedColor) upLeftCoordinate.X upLeftCoordinate.Y 2*radius 2*radius 0 360);
            }
            else
            {
                graphics.FillPie(new SolidBrush(fillColor) upLeftCoordinate.X  upLeftCoordinate.Y  2*radius 2*radius 0 360);
            }
        }


        public int Radius
        {
            get { return radius; }
            set { radius = value; }
        }
        
    }
}

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

     文件      17408  2012-03-06 13:17  DrawmetaGraph\DrawmetaGraph\bin\Debug\DrawmetaGraph.exe

     文件      54784  2012-03-06 13:17  DrawmetaGraph\DrawmetaGraph\bin\Debug\DrawmetaGraph.pdb

     文件      11600  2012-03-24 20:54  DrawmetaGraph\DrawmetaGraph\bin\Debug\DrawmetaGraph.vshost.exe

     文件        490  2009-08-31 00:40  DrawmetaGraph\DrawmetaGraph\bin\Debug\DrawmetaGraph.vshost.exe.manifest

     文件       1991  2012-03-06 12:27  DrawmetaGraph\DrawmetaGraph\Circle.cs

     文件       3885  2012-03-04 19:17  DrawmetaGraph\DrawmetaGraph\DrawmetaGraph.csproj

     文件       4544  2012-03-06 13:17  DrawmetaGraph\DrawmetaGraph\Form1.cs

     文件      11885  2012-03-06 13:14  DrawmetaGraph\DrawmetaGraph\Form1.Designer.cs

     文件       5817  2012-03-06 13:14  DrawmetaGraph\DrawmetaGraph\Form1.resx

     文件       2819  2012-03-04 20:47  DrawmetaGraph\DrawmetaGraph\GraghList.cs

     文件        588  2012-03-04 20:49  DrawmetaGraph\DrawmetaGraph\metaTypeGraph.cs

     文件       4440  2012-03-04 16:18  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6238  2012-03-06 13:17  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        787  2012-03-24 20:54  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\DrawmetaGraph.csproj.FileListAbsolute.txt

     文件      17408  2012-03-06 13:17  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\DrawmetaGraph.exe

     文件        180  2012-03-06 13:14  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\DrawmetaGraph.Form1.resources

     文件      54784  2012-03-06 13:17  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\DrawmetaGraph.pdb

     文件        180  2012-03-04 19:17  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\DrawmetaGraph.Properties.Resources.resources

     文件        232  2012-03-06 13:14  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\GenerateResource.read.1.tlog

     文件        586  2012-03-06 13:14  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\GenerateResource.write.1.tlog

     文件       7897  2012-03-04 16:20  DrawmetaGraph\DrawmetaGraph\obj\x86\Debug\ResolveAssemblyReference.cache

     文件        494  2012-03-04 09:40  DrawmetaGraph\DrawmetaGraph\Program.cs

     文件       1358  2012-03-04 09:40  DrawmetaGraph\DrawmetaGraph\Properties\AssemblyInfo.cs

     文件       2876  2012-03-04 09:40  DrawmetaGraph\DrawmetaGraph\Properties\Resources.Designer.cs

     文件       5612  2012-03-04 09:40  DrawmetaGraph\DrawmetaGraph\Properties\Resources.resx

     文件       1098  2012-03-04 09:40  DrawmetaGraph\DrawmetaGraph\Properties\Settings.Designer.cs

     文件        249  2012-03-04 09:40  DrawmetaGraph\DrawmetaGraph\Properties\Settings.settings

     文件       2285  2012-03-06 12:27  DrawmetaGraph\DrawmetaGraph\SelectBox.cs

     文件       3778  2012-03-06 12:46  DrawmetaGraph\DrawmetaGraph\Triangle.cs

     文件      17408  2012-03-05 15:32  DrawmetaGraph\DrawmetaGraph.exe

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

评论

共有 条评论