Completed
Last Updated: 04 Jan 2017 07:47 by ADMIN
ADMIN
Hristo
Created on: 08 Nov 2016 12:19
Category: Editors
Type: Bug Report
1
FIX. RadColorBox - spin editor changes are not persisted if the dialog is closed using the mouse and the OK button
The value set to the last spin editor is overridden with its previous value. 

How to reproduce: check the attached videos

Workaround: 
 public partial class Form1 : Form
 {
     public Form1()
     {
         InitializeComponent();

         this.radColorBox1.ValueChanging += radColorBox1_ValueChanging;
         ((RadForm)this.radColorBox1.ColorBoxElement.ColorDialog.ColorDialogForm).FormClosing += Form1_FormClosing;
     }

     bool cancelValueChange;
     Telerik.WinControls.UI.RadColorPicker.ProfessionalColors professionalColors;
     private void Form1_FormClosing(object sender, FormClosingEventArgs e)
     {
         Control colorSelector = this.radColorBox1.ColorBoxElement.ColorDialog.ColorDialogForm.RadColorSelector;
         RadPageView pageView = colorSelector.Controls[3] as RadPageView;
         if (pageView.SelectedPage.TabIndex == 3)
         {
             cancelValueChange = true;
             professionalColors = pageView.Pages[3].Controls[0] as Telerik.WinControls.UI.RadColorPicker.ProfessionalColors;
         }
         else
         {
             professionalColors = null;
         }
     }

     private void radColorBox1_ValueChanging(object sender, Telerik.WinControls.UI.ValueChangingEventArgs e)
     {
         if (cancelValueChange && professionalColors != null) 
         {
             e.Cancel = true;

             RadSpinEditor alphaSpinEditor = professionalColors.Controls[12] as RadSpinEditor;
             RadSpinEditor redSpinEditor = professionalColors.Controls[15] as RadSpinEditor;
             RadSpinEditor greenSpinEditor = professionalColors.Controls[11] as RadSpinEditor;
             RadSpinEditor blueSpinEditor = professionalColors.Controls[7] as RadSpinEditor;
             cancelValueChange = false;

             this.radColorBox1.Value = Color.FromArgb((int)alphaSpinEditor.Value, (int)redSpinEditor.Value, (int)greenSpinEditor.Value, (int)blueSpinEditor.Value);
             
         }
     }
 }

(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments