Beispiel #1
0
 private void Thumb_PreviewMouseMove(object sender, MouseEventArgs e)
 {
     try
     {
         if (isCaptured)
         {
             if (e.LeftButton == MouseButtonState.Pressed)
             {
                 if (!(e.GetPosition(this).X - Thumb.ActualWidth / 2 >= Bg.ActualWidth - Thumb.ActualWidth / 2 + 26))
                 {
                     if (!(e.GetPosition(this).X - Thumb.ActualWidth / 2 <= 25 - Thumb.ActualWidth / 2 - 1))
                     {
                         ThumbMove.Margin = new Thickness(e.GetPosition(this).X - Thumb.ActualWidth / 2 - 25, 0, 0, 0);
                         Progress.Width   = e.GetPosition(this).X + Thumb.ActualWidth / 2 - 25;
                         Animations.AnimateMargin(new Thickness(ValueLabel.Margin.Left, -4, 0, -2), new Thickness(e.GetPosition(this).X - Thumb.ActualWidth / 2 - 26, -4, 0, 4), ValueLabel, 0,
                                                  0, null);
                         ValueLabel.Margin = new Thickness(e.GetPosition(this).X - Thumb.ActualWidth / 2 - 26, -4, 0, 4);
                         Panel.SetZIndex(Thumb, Int32.MaxValue);
                         Value    = (int)Procent.procentX(Bg.ActualWidth, e.GetPosition(this).X - 25);
                         Val.Text = Value + "";
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
 public void SetProgressWidth(double p)
 {
     progress = Procent.procentX(width, p);
     AnimateWidth();
 }