コード例 #1
0
 public OverlayItemPosition(OverlayEffectPositionType positionType, int horizontal, int vertical)
 {
     this.PositionType = positionType;
     this.Horizontal   = horizontal;
     this.Vertical     = vertical;
 }
コード例 #2
0
        public OverlayItemPosition GetPosition()
        {
            int horizontal = 0;
            int vertical   = 0;
            OverlayEffectPositionType positionType = OverlayEffectPositionType.Percentage;

            if (this.PixelsPositionGrid.Visibility == Visibility.Visible)
            {
                if (string.IsNullOrEmpty(this.PixelPositionHorizontalTextBox.Text) || !int.TryParse(this.PixelPositionHorizontalTextBox.Text, out horizontal) || horizontal < 0 ||
                    string.IsNullOrEmpty(this.PixelPositionVerticalTextBox.Text) || !int.TryParse(this.PixelPositionVerticalTextBox.Text, out vertical) || vertical < 0)
                {
                    return(null);
                }
                positionType = OverlayEffectPositionType.Pixel;
            }
            else if (this.PercentagePositionGrid.Visibility == Visibility.Visible)
            {
                horizontal = (int)this.PercentagePositionHorizontalSlider.Value;
                vertical   = (int)this.PercentagePositionVerticalSlider.Value;
            }
            else
            {
                if (this.IsSimplePositionButtonSelected(this.TopLeftPositionButton))
                {
                    horizontal = 25;
                    vertical   = 25;
                }
                else if (this.IsSimplePositionButtonSelected(this.TopPositionButton))
                {
                    horizontal = 50;
                    vertical   = 25;
                }
                else if (this.IsSimplePositionButtonSelected(this.TopRightPositionButton))
                {
                    horizontal = 75;
                    vertical   = 25;
                }
                else if (this.IsSimplePositionButtonSelected(this.LeftPositionButton))
                {
                    horizontal = 25;
                    vertical   = 50;
                }
                else if (this.IsSimplePositionButtonSelected(this.CenterPositionButton))
                {
                    horizontal = 50;
                    vertical   = 50;
                }
                else if (this.IsSimplePositionButtonSelected(this.RightPositionButton))
                {
                    horizontal = 75;
                    vertical   = 50;
                }
                else if (this.IsSimplePositionButtonSelected(this.BottomLeftPositionButton))
                {
                    horizontal = 25;
                    vertical   = 75;
                }
                else if (this.IsSimplePositionButtonSelected(this.BottomPositionButton))
                {
                    horizontal = 50;
                    vertical   = 75;
                }
                else if (this.IsSimplePositionButtonSelected(this.BottomRightPositionButton))
                {
                    horizontal = 75;
                    vertical   = 75;
                }
            }
            return(new OverlayItemPosition(positionType, horizontal, vertical));
        }