'宣言 Public Event ValueObjectChanging As Infragistics.Win.UltraWinEditors.TrackBarValueChangingEventHandler
public event Infragistics.Win.UltraWinEditors.TrackBarValueChangingEventHandler ValueObjectChanging
イベント ハンドラが、このイベントに関連するデータを含む、Infragistics.Win.UltraWinEditors.TrackBarValueChangingEventArgs 型の引数を受け取りました。次の TrackBarValueChangingEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
NewValue | |
OldValue | |
Source |
Imports Infragistics.Win.UltraWinEditors Private Sub UltraTrackBar1_ValueObjectChanging(ByVal sender As System.Object, ByVal e As Infragistics.Win.TrackBarValueChangingEventArgs) Handles UltraTrackBar1.ValueObjectChanging Dim trackBar As UltraTrackBar = CType(sender, UltraTrackBar) ' This sample code will prevent the thumb from snapping to a value unless that value is a ' multiple of a number. Const multiple As Integer = 5 ' Is the value changing due to the dragging of the thumb? If (e.Source = TrackBarActionSource.Thumb) Then ' Cast the NewValue to an Integer. ' Under some circumstances, NewValue could be Nothing. Or it could be any object, since ' the control supports DataFilters. ' In this case, we will assume that nulls and DataFilters are not being used. Dim newValue As Integer = CType(e.NewValue, Integer) Dim extra As Integer = newValue Mod multiple ' Is the value not evenly divisible by 5. If (extra <> 0) Then newValue += (multiple - extra) ' Make sure the value doesn't go past the MaxValue. e.NewValue = Math.Min(newValue, trackBar.MaxValue) End If End If End Sub
using Infragistics.Win.UltraWinEditors; private void ultraTrackBar1_ValueObjectChanging(object sender, Infragistics.Win.TrackBarValueChangingEventArgs e) { UltraTrackBar trackBar = sender as UltraTrackBar; // This sample code will prevent the thumb from snapping to a value unless that value is a // multiple of a number. const int multiple = 5; // Is the value changing due to the dragging of the thumb? if (e.Source == TrackBarActionSource.Thumb) { // Cast the NewValue to an int. // Under some circumstances, NewValue could be null. Or it could be any object, since // the control supports DataFilters. // In this case, we will assume that nulls and DataFilters are not being used. int newValue = (int)e.NewValue; int extra = newValue % multiple; // Is the value not evenly divisible by 5. if (extra != 0) { newValue += (multiple - extra); // Make sure the value doesn't go past the MaxValue. e.NewValue = Math.Min(newValue, trackBar.MaxValue); } } }