예제 #1
0
 /// <summary>
 /// Raises the ValueChanging event.
 /// </summary>
 protected virtual void OnValueChanging(CancelIntValueEventArgs e)
 {
     if (ValueChanging != null)
         ValueChanging(this, e);
 }
예제 #2
0
        private void SetValue(int value, eEventSource source)
        {
            if (value == m_Value) return;

            CancelIntValueEventArgs e = new CancelIntValueEventArgs();
            e.NewValue = value;
            e.EventSource = source;

            OnValueChanging(e);

            if (e.Cancel)
                return;

            if (value < m_Minimum)
                m_Value = m_Minimum;
            else if (value > m_Maximum)
                m_Value = m_Maximum;
            else
                m_Value = value;

            OnValueChanged();

            if (ShouldSyncProperties)
                BarFunctions.SyncProperty(this, "Value");

            this.Refresh();
            OnAppearanceChanged();
            ExecuteCommand();
        }