Click here to Skip to main content
12,691,789 members (28,847 online)
Click here to Skip to main content

Tagged as

Stats

40.8K views
4.5K downloads
100 bookmarked
Posted

ButtonBar Control using .NET

, 3 Dec 2009 CPOL
Themed ButtonBar control supporting custom draw with full Designer support
using System.Drawing;
using System.Windows.Forms;

namespace ButtonBarsControl.Design.Generics
{
    /// <summary>
    /// Represents a method which can handle generic click event
    /// </summary>
    /// <typeparam name="T">Generic type which can be associated with the event.</typeparam>
    /// <param name="sender">Event source</param>
    /// <param name="e">Object containing event data.</param>
    public delegate void GenericClickEventHandler<T>(object sender, GenericClickEventArgs<T> e);

    /// <summary>
    /// Class storing information related to generic click event
    /// </summary>
    /// <typeparam name="T">Generic type which can be associated with the event.</typeparam>
    public class GenericClickEventArgs<T> : GenericEventArgs<T>
    {
        private readonly MouseButtons button;
        private readonly Point position;

        /// <summary>
        /// Initializes a new default instance
        /// </summary>
        public GenericClickEventArgs()
        {
            button = MouseButtons.None;
            position = Point.Empty;
        }

        /// <summary>
        /// Initializes a new instance using specified parameters
        /// </summary>
        /// <param name="value">Object to be associated with the event.</param>
        /// <param name="button">Mousebutton which was clicked</param>
        /// <param name="position">Position of mouse</param>
        public GenericClickEventArgs(T value, MouseButtons button, Point position) : base(value)
        {
            this.button = button;
            this.position = position;
        }

        /// <summary>
        /// Gets which mouse button was clicked.
        /// </summary>
        public MouseButtons Button
        {
            get { return button; }
        }

        /// <summary>
        /// Gets mouseposition when click was performed.
        /// </summary>
        public Point Position
        {
            get { return position; }
        }
    }
}

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)

Share

About the Author

Manish Ranjan Kumar
Software Developer (Senior)
India India
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170117.1 | Last Updated 3 Dec 2009
Article Copyright 2009 by Manish Ranjan Kumar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid