- painter_src.zip
- Painter_src
- Globe
- Globe Framework
- Core
- Converters
- Utilities
- Graphics
- Bidimensional
- Base
- Common
- Resources
- Rotate.ico
- Xml
- Serialization
- CSharp
- Globe Programs
- Painter
- Globe.sln
- painter_docs.zip
- Painter_docs
- Globe.Graphics.Bidimensional Documentation.chm
- Globe.Graphics.Bidimensional.vsd
- painter_demo.zip
- Painter_demo
- Disegno.xml
- Globe.Core.Converters.dll
- Globe.Core.Utilities.dll
- Globe.Graphics.Bidimensional.Base.dll
- Globe.Graphics.Bidimensional.Common.dll
- Globe.Xml.Serialization.dll
- Painter.exe
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Globe.Graphics.Bidimensional.Common;
namespace Globe.Graphics.Bidimensional.Base
{
/// <summary>
/// Selects more shapes.
/// </summary>
public class MultiSelect : Draw
{
#region Events and Delegates
/// <summary>
/// Function to notify shapes selection.
/// </summary>
/// <param name="tool">Tool that notifies.</param>
/// <param name="shapes">Shapes.</param>
public delegate void OnSelectedShapes(Tool tool, ShapeCollection shapes);
/// <summary>
/// Fires when shapes are selected.
/// </summary>
public event OnSelectedShapes SelectedShapes;
#endregion
#region Constructors
/// <summary>
/// Default constructor.
/// </summary>
public MultiSelect()
{
Ghost = new MultiSelectGhost();
}
#endregion
#region IActions Interface
/// <summary>
/// Mouse down function.
/// </summary>
/// <param name="document">Informations transferred from DrawingPanel.</param>
/// <param name="e">MouseEventArgs.</param>
public override void MouseDown(IDocument document, MouseEventArgs e)
{
if (Control.ModifierKeys != Keys.Control && e.Button != MouseButtons.Right)
Select.UnselectAll(document.Shapes);
base.MouseDown(document, e);
}
/// <summary>
/// Mouse up function.
/// </summary>
/// <param name="document">Informations transferred from DrawingPanel.</param>
/// <param name="e">MouseEventArgs.</param>
public override void MouseUp(IDocument document, MouseEventArgs e)
{
SelectIntersectedShapes(document.Shapes);
if (SelectedShapes != null)
SelectedShapes(this, Select.GetSelectedShapes(document.Shapes));
base.MouseUp(document, e);
}
/// <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)
{
Ghost.Paint(document, e);
}
#endregion
#region Private Functions
private void SelectIntersectedShapes(ShapeCollection shapes)
{
foreach (IShape shape in shapes)
{
if (Ghost.Geometric.GetBounds().IntersectsWith(
shape.Geometric.GetBounds()))
shape.Selected = true;
}
}
#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.
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.