Click here to Skip to main content
15,896,727 members
Articles / Multimedia / GDI+

Drawing Library

Rate me:
Please Sign up or sign in to vote.
4.78/5 (63 votes)
10 Dec 2007CPOL3 min read 294.5K   12.9K   211  
A library for creating shapes and developing tools.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using Globe.Graphics.Bidimensional.Common;

namespace Globe.Graphics.Bidimensional.Base
{
    /// <summary>
    /// Ghost used by multi select tool.
    /// </summary>
    [Serializable]
    public class MultiSelectGhost : Ghost
    {
        #region Constructors

        /// <summary>
        /// Default constructor.
        /// </summary>
        public MultiSelectGhost() : base(new Rectangle())
        {
            _brush = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(100, System.Drawing.Color.LightBlue));
        }

        #endregion

        #region IActions Interface

        /// <summary>
        /// Paint function
        /// </summary>
        /// <param name="document">Informations transferred from DrawingPanel</param>
        /// <param name="e">PaintEventArgs</param>
        public override void Paint(IDocument document, PaintEventArgs e)
        {
            if (!Visible)
                return;

            e.Graphics.FillRectangle(_brush, System.Drawing.Rectangle.Round(new System.Drawing.RectangleF(Location, Dimension)));
            e.Graphics.DrawRectangle(System.Drawing.Pens.Black, System.Drawing.Rectangle.Round(Geometric.GetBounds()));
        }

        #endregion

        #region Properties

        System.Drawing.SolidBrush _brush = null;
        /// <summary>
        /// Gets or sets the brush to draw.
        /// </summary>
        protected System.Drawing.SolidBrush DrawingBrush
        {
            get { return _brush; }
            set { _brush = value; }
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Italy Italy
I am a biomedical engineer. I work in Genoa as software developer. I developed MFC ActiveX controls for industrial automation for 2 years and packages for Visual Studio 2005 for 1 year. Currently I'm working in .NET 3.5 in biomedical area.

Comments and Discussions