Source/Controls/ColorPickerButton.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Text;
using System.ComponentModel;
using System.Drawing;

namespace DevComponents.DotNetBar
{
    /// <summary>
    /// Represents the color picker button control.
    /// </summary>
    [ToolboxBitmap(typeof(ColorPickerButton), "Controls.ColorPickerButton.ico"), ToolboxItem(true), DefaultEvent("SelectedColorChanged"), Designer(typeof(Design.ColorPickerButtonDesigner)), System.Runtime.InteropServices.ComVisible(false)]
    public class ColorPickerButton : ButtonX
    {
        #region Private Variables
        #endregion

        #region Events
        /// <summary>
        /// Occurs when color is chosen from drop-down color picker or from Custom Colors dialog box. Selected color can be accessed through SelectedColor property.
        /// </summary>
        [Description("Occurs when color is chosen from drop-down color picker or from Custom Colors dialog box.")]
        public event EventHandler SelectedColorChanged;

        /// <summary>
        /// Occurs when mouse is moving over the colors presented by the color picker. You can use it to preview the color before it is selected.
        /// </summary>
        [Description("Occurs when mouse is moving over the colors presented by the color picker")]
        public event ColorPreviewEventHandler ColorPreview;
        #endregion

        #region Constructor
        /// <summary>
        /// Creates new instance of the object.
        /// </summary>
        public ColorPickerButton()
            : base()
        {
            ColorPickerDropDown cp = GetColorPickerDropDown();
            cp.SelectedColorChanged += new EventHandler(InternalSelectedColorChanged);
            cp.ColorPreview += new ColorPreviewEventHandler(InternalColorPreview);
        }
        #endregion

        #region Internal Implementation
        /// <summary>
        /// Displays the Colors dialog that allows user to choose the color or create a custom color. If new color is choosen the
        /// SelectedColorChanged event is raised.
        /// </summary>
        public void DisplayMoreColorsDialog()
        {
            GetColorPickerDropDown().DisplayMoreColorsDialog();
        }

        protected override ButtonItem CreateButtonItem()
        {
            return new ColorPickerDropDown();
        }

        private ColorPickerDropDown GetColorPickerDropDown()
        {
后面还有 141 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。