Inheritance: RoutedEventArgs, IDragDeltaEventArgs
コード例 #1
0
 private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
 {
     try
     {
         var transform = (TranslateTransform)thumb.RenderTransform;
         transform.X = Math.Max(0, Math.Min(transform.X + e.HorizontalChange, this.ActualWidth - thumb.ActualWidth));
         mapImagery.Clip.Rect = new Rect(0, 0, transform.X, this.ActualHeight);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
コード例 #2
0
        private void Thumb_DragDelta_1(object sender, DragDeltaEventArgs e)
        {
            Grid gd = (Grid)((Thumb)sender).Parent;
            double x, y;
            x = (double)gd.GetValue(Canvas.LeftProperty) + e.HorizontalChange;
            y = (double)gd.GetValue(Canvas.TopProperty) + e.VerticalChange;

            if (x < innerCanvas.Width - 4 && y < innerCanvas.Height - 4 && x > -4 && y > -4)
            {
                innerEll.SetValue(Canvas.LeftProperty, x);
                innerEll.SetValue(Canvas.TopProperty, y);

                FinalColor.Fill = new SolidColorBrush(LinearGdHelperClass.GetColorAtPoint(rectColor, new Point(x + 4, y + 4)));
                SelectedColor = LinearGdHelperClass.GetColorAtPoint(rectColor, new Point(x + 4, y + 4));

            }

        }
コード例 #3
0
ファイル: RangeSelector.cs プロジェクト: KooKiz/comet
 private void MaxThumb_DragDelta(object sender, DragDeltaEventArgs e)
 {
     RangeMax = DragThumb(MaxThumb, Canvas.GetLeft(MinThumb), ContainerCanvas.ActualWidth, Canvas.GetLeft(MaxThumb) + e.HorizontalChange);
 }
コード例 #4
0
ファイル: Resizer.cs プロジェクト: crazycreak/Template10
 private void thumb_DragDelta(object sender, DragDeltaEventArgs e)
 {
     ElementControl.Width = Math.Max(0, ElementControl.ActualWidth + e.HorizontalChange); //HorizontalChange could become negative
     ElementControl.Height = Math.Max(0, ElementControl.ActualHeight + e.VerticalChange); //VerticalChange could become negative
 }
コード例 #5
0
ファイル: RangeSelector.cs プロジェクト: psaniuk/win-toolkit
        private void RightThumbDragDelta(object sender, DragDeltaEventArgs e)
        {
            var thumb = (Thumb) sender;

            var thumbTransformation = (TranslateTransform) thumb.RenderTransform;
            if (thumbTransformation.X + e.HorizontalChange >= 0.0)
            {
                thumbTransformation.X = 0.0;
            }
            else if (IsRightThumbShiftIsLessLeftThumbPosition(e.HorizontalChange))
            {
                ((TranslateTransform) thumb.RenderTransform).X += e.HorizontalChange;
            }

            UpdateEndRange();
            UpdateTrack();
        }
コード例 #6
0
ファイル: RangeSelector.cs プロジェクト: KooKiz/comet
 private void MinThumb_DragDelta(object sender, DragDeltaEventArgs e)
 {
     RangeMin = DragThumb(MinThumb, 0, Canvas.GetLeft(MaxThumb), Canvas.GetLeft(MinThumb) + e.HorizontalChange);
 }
コード例 #7
0
        private void OnDragDelta(object sender, DragDeltaEventArgs e)
        {
            double outRad = Math.Min(ActualHeight, ActualWidth);
            if (_ring1 != null)
                outRad = Math.Min(_ring1.ActualHeight, _ring1.ActualWidth);
            if (_ring2 != null)
                outRad = Math.Min(_ring2.ActualHeight, _ring2.ActualWidth);

            var thumbSize = GetThumbSize();
            outRad = (outRad - thumbSize) / 2;

            switch (ThumbPosition)
            {
                case RadialSliderThumbPosition.Center:
                    thumbSize = 0;
                    break;
                case RadialSliderThumbPosition.Border:
                    thumbSize /= 2;
                    break;
            }

            _dragStarted = new Point(_dragStarted.X + e.HorizontalChange, _dragStarted.Y + e.VerticalChange);
            var angle = Math.Atan2(SweepDirection == SweepDirection.Clockwise ? _dragStarted.Y - outRad - thumbSize : (2 * outRad) - _dragStarted.Y - outRad + thumbSize, _dragStarted.X - outRad - thumbSize);

            angle -= RotationAngle / 180 * Math.PI;

            Value = Normalize(angle / Math.PI / 2 * (Maximum - Minimum) + Minimum);

            //if (angle > 2 * Math.PI)
            //    angle -= 2 * Math.PI;

            //if (angle > 0)
            //    Value = angle / Math.PI / 2 * (Maximum - Minimum) + Minimum;
            //else
            //    Value = (angle + Math.PI * 2) / Math.PI / 2 * (Maximum - Minimum) + Minimum;
        }
コード例 #8
0
ファイル: Block.xaml.cs プロジェクト: ronlemire2/UWP-Testers
 void OnThumbDragDelta(object sender, DragDeltaEventArgs args) {
     Canvas.SetLeft(this, Canvas.GetLeft(this) + args.HorizontalChange);
     Canvas.SetTop(this, Canvas.GetTop(this) + args.VerticalChange);
 }
コード例 #9
0
ファイル: RangeSlider.cs プロジェクト: mjeanrichard/TeensyBat
 private void MiddleThumbDrageDelta(object sender, DragDeltaEventArgs e)
 {
     double change = ConvertValueChange(e.HorizontalChange);
     SetUpperValue(change);
     SetLowerValue(change);
 }
コード例 #10
0
ファイル: RangeSlider.cs プロジェクト: mjeanrichard/TeensyBat
 private void LowerThumb_DragDelta(object sender, DragDeltaEventArgs e)
 {
     SetLowerValue(ConvertValueChange(e.HorizontalChange));
 }
コード例 #11
0
        private void OnThumbDragDelta(object sender, DragDeltaEventArgs args)
        {
            Thumb thumb = (Thumb)sender;
            Grid grid = (Grid)thumb.Parent;
            ColumnDefinition leftColDef = grid.ColumnDefinitions[0];
            ColumnDefinition rightColDef = grid.ColumnDefinitions[2];

            try
            {
                leftColDef.Width = new GridLength(leftColDef.Width.Value + args.HorizontalChange, GridUnitType.Star);
                rightColDef.Width = new GridLength(rightColDef.Width.Value - args.HorizontalChange, GridUnitType.Star);
            }
            catch (System.ArgumentException)
            {
            }
        }
コード例 #12
0
 private void BlackEllipse_DragDelta(object sender, Windows.UI.Xaml.Controls.Primitives.DragDeltaEventArgs e)
 {
 }
コード例 #13
0
        private void LowerThumb_DragDelta(object sender, DragDeltaEventArgs e)
        {
            RowDefinition lowerRect = root.RowDefinitions.ElementAt(4);
            RowDefinition upperRect = root.RowDefinitions.ElementAt(0);
            double upperRectHeight = upperRect.Height.Value;
            double remainingTrackSpace = this.ActualHeight - upperRectHeight - LowerThumb.ActualHeight;

            double lowerRectHeight = lowerRect.Height.Value;
            double inverseVertChange = e.VerticalChange * -1.0;
            double updatedLowerRectHeight = lowerRectHeight += inverseVertChange;

            if (updatedLowerRectHeight > remainingTrackSpace)
            {
                LowerThumb.CancelDrag();
            }
            else
            {
                if (updatedLowerRectHeight > 0)
                {
                    lowerRect.Height = new GridLength(updatedLowerRectHeight);
                }
            }
        }
コード例 #14
0
        private void UpperThumb_DragDelta(object sender, DragDeltaEventArgs e)
        {
            RowDefinition upperRect = root.RowDefinitions.ElementAt(0);
            RowDefinition lowerRect = root.RowDefinitions.ElementAt(4);
            double lowerRectHeight = lowerRect.Height.Value;
            double remainingTrackSpace = this.ActualHeight - lowerRectHeight - UpperThumb.ActualHeight;

            double upperRectHeight = upperRect.Height.Value;
            double updatedUpperRectHeight = upperRectHeight += e.VerticalChange;

            // if the new height is larger than the available space, cancel the drag
            // otherwise the upper and lower values will overlap
            if (updatedUpperRectHeight > remainingTrackSpace)
            {
                UpperThumb.CancelDrag();
            }
            else
            {
                if (updatedUpperRectHeight > 0)
                {
                    upperRect.Height = new GridLength(updatedUpperRectHeight);
                }
            }
        }
コード例 #15
0
 private void OnThumbDragDelta(object sender, DragDeltaEventArgs e)
 {
     if (((this.thumb != null) && (this.trackPanel != null)) && (this.trackPanel.Children.Count > 0))
     {
         this.dragValue -= e.VerticalChange;
         double d = base.Minimum + (this.dragValue / this.trackPanel.Children[0].RenderSize.Height);
         if (!double.IsNaN(d) && !double.IsInfinity(d))
         {
             d = Math.Min(base.Maximum, Math.Max(base.Minimum, d));
             if (d != base.Value)
             {
                 base.Value = d;
             }
         }
     }
 }