void colorPickEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Caption != "MoreColors")
            {
                return;
            }
            ColorPickEdit edit = sender as ColorPickEdit;
            RepositoryItemColorPickEdit ritem = edit.Properties;

            try {
                ritem.LockEventsCore();
                using (FrmColorPicker frm = new FrmColorPicker(ritem)) {
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    var editorColor = (Color)ritem.OwnerEdit.EditValue;
                    frm.SelectedColor = editorColor.IsEmpty ? Color.FromArgb(255, editorColor) : editorColor;
                    frm.TopMost       = true;
                    if (frm.ShowDialog(ritem.OwnerEdit.FindForm()) == DialogResult.OK)
                    {
                        ritem.OwnerEdit.EditValue = frm.SelectedColor;
                        //updating recent colors
                        ritem.RecentColors.InsertColor(frm.SelectedColor, 0);
                    }
                }
            } finally {
                ritem.ReleaseEventsCore(true);
            }
        }
        //Menu item click handler
        public static void OnFixedClick(object sender, EventArgs e)
        {
            DXMenuItem item = sender as DXMenuItem;
            MenuInfo   info = item.Tag as MenuInfo;

            if (info == null)
            {
                return;
            }

            if (item.Caption.Substring(0, 3) == "Col")
            {
                if (item.Caption == "Color Customize...")
                {
                    ColorPickEdit  colorPickerEdit = new ColorPickEdit();
                    FrmColorPicker frm             = new FrmColorPicker(colorPickerEdit.Properties);
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.TopMost       = true;
                    if (frm.ShowDialog(colorPickerEdit.FindForm()) == DialogResult.OK)
                    {
                        info.Column.AppearanceCell.BackColor = frm.SelectedColor;
                    }
                }
                else
                {
                    info.Column.AppearanceCell.BackColor = ((Bitmap)item.Image).GetPixel(5, 5);
                }
            }
            else if (item.Caption.Substring(0, 4) == "Font")
            {
                FontDialog fontDialog = new FontDialog();
                fontDialog.ShowDialog();
                info.Column.AppearanceCell.Font = fontDialog.Font;
            }
            else
            {
                if (item.Caption == "ForeColor Customize...")
                {
                    ColorPickEdit  colorPickerEdit = new ColorPickEdit();
                    FrmColorPicker frm             = new FrmColorPicker(colorPickerEdit.Properties);
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.TopMost       = true;
                    if (frm.ShowDialog(colorPickerEdit.FindForm()) == System.Windows.Forms.DialogResult.OK)
                    {
                        info.Column.AppearanceCell.ForeColor = frm.SelectedColor;
                    }
                }
                else
                {
                    info.Column.AppearanceCell.ForeColor = ((Bitmap)item.Image).GetPixel(5, 5);
                }
            }
        }
Exemple #3
0
 protected virtual void DoShowColorDialog()
 {
     using (FrmColorPicker frm = new FrmColorPicker(Properties)) {
         frm.StartPosition = FormStartPosition.CenterScreen;
         frm.SelectedColor = this.selectedColor;
         if (frm.ShowDialog(GetOwner()) == DialogResult.OK)
         {
             Color color = frm.SelectedColor;
             DoSaveColor(color);
         }
     }
 }