/// <summary>
 /// Raises the BeforeColorDialog event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnBeforeColorDialog(CancelObjectValueEventArgs e)
 {
     CancelObjectValueEventHandler h = this.BeforeColorDialog;
     if (h != null)
         h(this, e);
 }
        /// <summary>
        /// Displays the Colors dialog that allows user to choose the color or create a custom color. If new color is chosen the
        /// SelectedColorChanged event is raised.
        /// </summary>
        public DialogResult DisplayMoreColorsDialog()
        {
            DialogResult result = DialogResult.Cancel;

            if (this.EffectiveStyle == eDotNetBarStyle.Metro)
            {
                ColorPickerItem.CustomColorDialogMetro d = new ColorPickerItem.CustomColorDialogMetro();
                d.SetStyle(this.EffectiveStyle);
                d.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                if (!this.SelectedColor.IsEmpty)
                    d.CurrentColor = this.SelectedColor;
                LocalizeDialog(d);
                CancelObjectValueEventArgs e = new CancelObjectValueEventArgs(d);
                OnBeforeColorDialog(e);
                if (e.Cancel)
                {
                    d.Dispose();
                    return DialogResult.None;
                }
                if (_OwnerWindow != null)
                {
                    if (_OwnerWindow is Form && ((Form)_OwnerWindow).TopMost)
                        d.TopMost = true;
                    d.ShowDialog(_OwnerWindow);
                }
                else
                    d.ShowDialog();

                result = d.DialogResult;
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    if (!d.NewColor.IsEmpty)
                    {
                        this.SetSelectedColor(d.NewColor);
                    }
                }

                d.Dispose();
            }
            else
            {
                ColorPickerItem.CustomColorDialog d = new ColorPickerItem.CustomColorDialog();
                d.SetStyle(this.EffectiveStyle);
                d.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                if (!this.SelectedColor.IsEmpty)
                    d.CurrentColor = this.SelectedColor;
                LocalizeDialog(d);
                CancelObjectValueEventArgs e = new CancelObjectValueEventArgs(d);
                OnBeforeColorDialog(e);
                if (e.Cancel)
                {
                    d.Dispose();
                    return DialogResult.None;
                }
                if (_OwnerWindow != null)
                {
                    if (_OwnerWindow is Form && ((Form)_OwnerWindow).TopMost)
                        d.TopMost = true;
                    d.ShowDialog(_OwnerWindow);
                }
                else
                    d.ShowDialog();

                result = d.DialogResult;
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    if (!d.NewColor.IsEmpty)
                    {
                        this.SetSelectedColor(d.NewColor);
                    }
                }

                d.Dispose();
            }
            return result;
        }