private void anyTrackBar_ValueChanged(object sender, EventArgs e) { if (valueChanging) { return; } try { valueChanging = true; value.Minimum = rangeAttr.GetValueFromTrackBar(IsIntegerType(), minTrackBar.Value); value.Maximum = rangeAttr.GetValueFromTrackBar(IsIntegerType(), maxTrackBar.Value); minTextBox.Text = value.Minimum.ToString(); maxTextBox.Text = value.Maximum.ToString(); ValidateTextBox(minTextBox); ValidateTextBox(maxTextBox); UpdateItemProperty(); } finally { valueChanging = false; } }
private void TrackBar_ValueChanged(object sender, EventArgs e) { if (trackBarDisableValueChangedEvent) { return; } if (!trackBarFocused) { return; } //begin modifying. save old values for undo if (!trackBarModifying) { trackBarItemInHierarchyToAddUndo = GetItemInHierarchyToRestoreValues(); trackBarItemInHierarchyToAddUndo.SaveValuesToRestore(); trackBarModifying = true; } var control = (IHCTextBoxNumeric)CreatedControlInsidePropertyItemControl; var trackBar = control.TrackBar; trackBarDisableValueChangedEvent = true; var netType = Property.Type.GetNetType(); var unrefType = ReferenceUtility.GetUnreferencedType(netType); try { double doubleValue = range.GetValueFromTrackBar(IsInteger(), trackBar.Value); //conversion by means string string str; if (IsInteger()) { str = Convert.ToInt64(doubleValue).ToString(); } else { str = doubleValue.ToString(); } var value = SimpleTypes.ParseValue(unrefType, str); SetValue(value, false); } catch { } trackBarDisableValueChangedEvent = false; }