示例#1
0
 private void VolumeControl_OnMouseMove(object sender, MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed && VolumeControl.Value <= 1f && VolumeControl.Value >= 0f)
     {
         VolumeControl.CaptureMouse();
         double volume = GetVolumeFromMousePosition(e.GetPosition(VolumeControl).X);
         if (volume <= 1d && volume >= 0d)
         {
             VolumeControl.Value = volume;
         }
         else if (volume >= 1d)
         {
             VolumeControl.Value = 1f;
         }
         else if (volume <= 0d)
         {
             VolumeControl.Value = 0f;
         }
     }
 }