コード例 #1
0
ファイル: MetroTemplate.cs プロジェクト: vainamov/nUpdate
 protected override void DrawDisabled(Graphics g, ArrowDirection direction)
 {
     g.DrawEllipse(_disabledPen, _circleRect);
     if (direction == ArrowDirection.Right)
         g.MultiplyTransform(new Matrix(-1, 0, 0, 1, 23, 0));
     g.DrawPath(_disabledArrowPen, _arrowPath);
 }
コード例 #2
0
 /// <include file='doc\ToolStripArrowRenderEventArgs.uex' path='docs/doc[@for="ToolStripArrowRenderEventArgs.ToolStripArrowRenderEventArgs"]/*' />
 public ToolStripArrowRenderEventArgs(Graphics g, ToolStripItem toolStripItem, Rectangle arrowRectangle, Color arrowColor, ArrowDirection arrowDirection) {
     this.item = toolStripItem;
     this.graphics = g;
     this.arrowRect = arrowRectangle;
     this.defaultArrowColor = arrowColor;
     this.arrowDirection = arrowDirection;
 }
コード例 #3
0
 public override void CheckSolution(ArrowDirection arrowDirection)
 {
     if (arrowDirection == ArrowDirection.UP)
     {
         this.correct = true;
     }
 }
コード例 #4
0
        public override void MoveModelToView(ArchetypeData model)
        {
            base.MoveModelToView(model);
                        
            var m = model as ArrowWorldObjectArchetypeData;

            this.ArrowDirection = m.ArrowDirection;
        }
コード例 #5
0
ファイル: MetroTemplate.cs プロジェクト: vainamov/nUpdate
 protected override void DrawHover(Graphics g, ArrowDirection direction)
 {
     g.FillEllipse(_hoverBrush,
         new RectangleF(_circleRect.X - 0.5f, _circleRect.Y - 0.5f, _circleRect.Width + 1,
             _circleRect.Height + 1));
     if (direction == ArrowDirection.Right)
         g.MultiplyTransform(new Matrix(-1, 0, 0, 1, 23, 0));
     g.DrawPath(_hoverArrowPen, _arrowPath);
 }
コード例 #6
0
		public ToolStripArrowRenderEventArgs (Graphics g, ToolStripItem toolStripItem, Rectangle arrowRectangle, Color arrowColor, ArrowDirection arrowDirection)
			: base ()
		{
			this.graphics = g;
			this.tool_strip_item = toolStripItem;
			this.arrow_rectangle = arrowRectangle;
			this.arrow_color = arrowColor;
			this.arrow_direction = arrowDirection;
		}
コード例 #7
0
        protected override void UpdateShape(ArrowDirection pointerDirection)
        {
            switch (pointerDirection)
            {
                case ArrowDirection.Left: ShapePathData = Shapes.RoundedPointerLeft; break;
                case ArrowDirection.Right: ShapePathData = Shapes.RoundedPointerRight; break;
                case ArrowDirection.Up: ShapePathData = Shapes.RoundedPointerUp; break;
                case ArrowDirection.Down: ShapePathData = Shapes.RoundedPointerDown; break;

                default: throw new NotSupportedException(PointerDirection.ToString());
            }
        }
コード例 #8
0
 public PaintScrollBarArrowEventArgs(
     Graphics graphics,
     Rectangle arrowRect,
     ControlState controlState,
     ArrowDirection arrowDirection,
     Orientation orientation)
     : this(graphics,
     arrowRect,
     controlState,
     arrowDirection,
     orientation,
     true)
 {
 }
コード例 #9
0
 public PaintScrollBarArrowEventArgs(
     Graphics graphics,
     Rectangle arrowRect,
     ControlState controlState,
     ArrowDirection arrowDirection,
     Orientation orientation,
     bool enabled)
 {
     _graphics = graphics;
     _arrowRect = arrowRect;
     _controlState = controlState;
     _arrowDirection = arrowDirection;
     _orientation = orientation;
     _enabled = enabled;
 }
コード例 #10
0
        /// <summary>
        ///     Renders the arrows in the OverflowButton.
        /// </summary>
        /// <param name="graphics">The Graphics to draw on.</param>
        /// <param name="dropDownRectangle">The rectangle in which the arrows should drawn.</param>
        /// <param name="direction">the direction of the arrows.</param>
        /// <param name="color">The color used to fill the arrow polygons</param>
        private static void RenderArrowInternal(Graphics graphics, Rectangle dropDownRectangle,
                                                ArrowDirection direction, Color color)
        {
            var point = new Point(dropDownRectangle.Left + dropDownRectangle.Width / 2,
                                  dropDownRectangle.Top + dropDownRectangle.Height / 2);

            point.X += dropDownRectangle.Width % 2;
            Point[] points;
            switch (direction)
            {
            case ArrowDirection.Left:
                points = new[]
                {
                    new Point(point.X + 2, point.Y - 3), new Point(point.X + 2, point.Y + 3),
                    new Point(point.X - 1, point.Y)
                };
                break;

            case ArrowDirection.Up:
                points = new[]
                {
                    new Point(point.X - 2, point.Y + 1), new Point(point.X + 3, point.Y + 1),
                    new Point(point.X, point.Y - 2)
                };
                break;

            case ArrowDirection.Right:
                points = new[]
                {
                    new Point(point.X - 2, point.Y - 3), new Point(point.X - 2, point.Y + 3),
                    new Point(point.X + 1, point.Y)
                };
                break;

            default:
                points = new[]
                {
                    new Point(point.X - 2, point.Y - 1), new Point(point.X + 3, point.Y - 1),
                    new Point(point.X, point.Y + 2)
                };
                break;
            }

            using (var backBrush = new SolidBrush(color))
            {
                graphics.FillPolygon(backBrush, points);
            }
        }
コード例 #11
0
ファイル: ImageComboBox.cs プロジェクト: radtek/NetDNALims
        internal void RenderArrowInternal(
            Graphics g,
            Rectangle dropDownRect,
            ArrowDirection direction,
            Brush brush)
        {
            g.FillRectangle(new SolidBrush(Color.White), dropDownRect);
            Point point = new Point(
                dropDownRect.Left + (dropDownRect.Width / 2),
                dropDownRect.Top + (dropDownRect.Height / 2));

            Point[] points = null;
            switch (direction)
            {
            case ArrowDirection.Left:
                points = new Point[] {
                    new Point(point.X + 2, point.Y - 3),
                    new Point(point.X + 2, point.Y + 3),
                    new Point(point.X - 1, point.Y)
                };
                break;

            case ArrowDirection.Up:
                points = new Point[] {
                    new Point(point.X - 3, point.Y + 2),
                    new Point(point.X + 3, point.Y + 2),
                    new Point(point.X, point.Y - 2)
                };
                break;

            case ArrowDirection.Right:
                points = new Point[] {
                    new Point(point.X - 2, point.Y - 3),
                    new Point(point.X - 2, point.Y + 3),
                    new Point(point.X + 1, point.Y)
                };
                break;

            default:
                points = new Point[] {
                    new Point(point.X - 4, point.Y - 2),
                    new Point(point.X + 4, point.Y - 3),
                    new Point(point.X, point.Y + 2)
                };
                break;
            }
            g.FillPolygon(brush, points);
        }
コード例 #12
0
    public Vector4 xint;//intersection of worldline with PLC

    // Use this for initialization
    void Start()
    {
        ad = targetObject.GetComponent <ArrowDirection>();
        R  = Matrix4x4.identity;
        playrposworldframe4 = new Vector4(transform.position.x, transform.position.y, transform.position.z, 0f);
        playrvelworldframe3 = new Vector3(0.0f, 0.0f, 0.0f);
        playrvelworldframe4 = new Vector4(playrvelworldframe3.x, playrvelworldframe3.y, playrvelworldframe3.z, 1f);
        u3hat            = playrvelworldframe3.normalized;
        Lplayer          = Matrix4x4.identity;
        metrictensor     = Matrix4x4.identity;
        metrictensor.m33 = -1;
        qom = -0.01f;
        aq  = ad.q;
        Debug.Log($"Q0={ad.q}");
        ppoL.Add(playrposworldframe4);
    }
コード例 #13
0
    public void AddPlotPoint(Vector2 Point)
    {
        ArrowDirection Dir = ArrowDirection.Undefined;

        if (Points.Count != PlotPointIndex++)
        {
            return;
        }
        if (Points.Count >= 1)
        {
            Dir = ArrowDirectionUtil.GetBestFitRelativeCardinalDirection(Points[Points.Count - 1].Point, Point);
        }
        PlottableArrowPoint ArrowPoint = new PlottableArrowPoint(Point, Dir);

        Points.Add(ArrowPoint);
    }
コード例 #14
0
ファイル: RenderHelper.cs プロジェクト: yzwbrian/winform-ui
        internal static void RenderArrowInternal(
            Graphics g,
            Rectangle dropDownRect,
            ArrowDirection direction,
            Brush brush)
        {
            Point point = new Point(
                dropDownRect.Left + (dropDownRect.Width / 2),
                dropDownRect.Top + (dropDownRect.Height / 2));

            Point[] points = null;
            switch (direction)
            {
            case ArrowDirection.Left:
                points = new Point[] {
                    new Point(point.X + 1, point.Y - 4),
                    new Point(point.X + 1, point.Y + 4),
                    new Point(point.X - 2, point.Y)
                };
                break;

            case ArrowDirection.Up:
                points = new Point[] {
                    new Point(point.X - 4, point.Y + 1),
                    new Point(point.X + 4, point.Y + 1),
                    new Point(point.X, point.Y - 2)
                };
                break;

            case ArrowDirection.Right:
                points = new Point[] {
                    new Point(point.X - 2, point.Y - 4),
                    new Point(point.X - 2, point.Y + 4),
                    new Point(point.X + 1, point.Y)
                };
                break;

            default:
                points = new Point[] {
                    new Point(point.X - 4, point.Y - 1),
                    new Point(point.X + 4, point.Y - 1),
                    new Point(point.X, point.Y + 2)
                };
                break;
            }
            g.FillPolygon(brush, points);
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="G"></param>
        /// <param name="DropDownRect"></param>
        /// <param name="Direction"></param>
        /// <param name="Brush"></param>
        internal void RenderArrowInternal(
            Graphics G,
            Rectangle DropDownRect,
            ArrowDirection Direction,
            Brush Brush)
        {
            Point point = new Point(
                DropDownRect.Left + (DropDownRect.Width / 2),
                DropDownRect.Top + (DropDownRect.Height / 2));

            Point[] points = null;
            switch (Direction)
            {
            case ArrowDirection.Left:
                points = new Point[] {
                    new Point(point.X + 1, point.Y - 4),
                    new Point(point.X + 1, point.Y + 4),
                    new Point(point.X - 2, point.Y)
                };
                break;

            case ArrowDirection.Up:
                points = new Point[] {
                    new Point(point.X - 3, point.Y + 1),
                    new Point(point.X + 3, point.Y + 1),
                    new Point(point.X, point.Y - 1)
                };
                break;

            case ArrowDirection.Right:
                points = new Point[] {
                    new Point(point.X - 1, point.Y - 4),
                    new Point(point.X - 1, point.Y + 4),
                    new Point(point.X + 2, point.Y)
                };
                break;

            default:
                points = new Point[] {
                    new Point(point.X - 3, point.Y - 1),
                    new Point(point.X + 3, point.Y - 1),
                    new Point(point.X, point.Y + 1)
                };
                break;
            }
            G.FillPolygon(Brush, points);
        }
コード例 #16
0
        private void CheckNextToolStripItem(ArrowDirection direction)
        {
            ToolStripButton button = toolStrip1
                                     .Items
                                     .Cast <ToolStripButton>()
                                     .FirstOrDefault(t => t.Checked);

            if (button != null)
            {
                ToolStripButton nextButton = (ToolStripButton)toolStrip1.GetNextItem(button, direction);

                if (nextButton != null)
                {
                    nextButton.PerformClick();
                }
            }
        }
コード例 #17
0
        public static LaneArrows ArrowDir2LaneArrows(ArrowDirection arrowDir)
        {
            switch (arrowDir)
            {
            case ArrowDirection.Forward:
                return(LaneArrows.Forward);

            case ArrowDirection.Left:
                return(LaneArrows.Left);

            case ArrowDirection.Right:
                return(LaneArrows.Right);

            default:
                return(LaneArrows.None);
            }
        }
コード例 #18
0
        private void HandleMultiDirection(ArrowInfo arrowInfo, ArrowDirection recievedDirection)
        {
            if (ArrowDirectionUtility.IsInCombinationFor(recievedDirection, arrowInfo.direction))
            {
                ArrowDirection combination = ArrowDirectionUtility.Combine(recievedDirection, m_TemporaryArrowDirection);

                if (combination == arrowInfo.direction)
                {
                    HitNote(arrowInfo);
                    m_TemporaryArrowDirection = ArrowDirection.none;
                }
                else
                {
                    m_TemporaryArrowDirection = recievedDirection;
                }
            }
        }
コード例 #19
0
ファイル: PriorityRoad.cs プロジェクト: me22/TMPE
        private static LaneArrows ToLaneArrows(ArrowDirection dir)
        {
            switch (dir)
            {
            case ArrowDirection.Forward:
                return(LaneArrows.Forward);

            case ArrowDirection.Left:
                return(LaneArrows.Left);

            case ArrowDirection.Right:
                return(LaneArrows.Right);

            default:
                return(LaneArrows.None);
            }
        }
コード例 #20
0
        /// <summary>
        /// Sows as L panel.
        /// </summary>
        /// <param name="doc">The active document.</param>
        /// <param name="tr">The active transaction.</param>
        protected RivieraObject InsertLPanel(RivieraObject obj, ArrowDirection direction, params RivieraMeasure[] sizes)
        {
            //1: Se calcula la dirección y orientación del panel
            Point3d end, start;

            //Siempre se inserta en la posición inicial del bloque insertado
            //Selección de la dirección
            start = obj.Start.ToPoint3d();
            end   = direction.IsFront() ? start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle).ToPoint3d()          //Misma dirección
                                      : start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle + Math.PI).ToPoint3d(); //Dirección Invertida
            //Selección de la rotación
            SweepDirection rotation = direction.IsLeft() ? SweepDirection.Counterclockwise : SweepDirection.Clockwise;
            //Seleccion de tipo de L
            BordeoLPanelAngle lAng = direction.GetArrowDirectionName().Contains("90") ? BordeoLPanelAngle.ANG_90 : BordeoLPanelAngle.ANG_135;
            //Se convierten los tamaños a tamaños de bordeo
            IEnumerable <LPanelMeasure> pSizes = sizes.Select(x => x as LPanelMeasure);
            //El panel inferios se usa como distancia base del arreglo de paneles.
            var first = sizes[0] as LPanelMeasure;
            //Se crea el panel
            BordeoLPanelStack stack = new BordeoLPanelStack(start, end, first, rotation, lAng);

            //Se agregan los tamaños superiores
            for (int i = 1; i < sizes.Length; i++)
            {
                stack.AddPanel(sizes[i] as LPanelMeasure);
            }
            //Se dibuja en el plano y se borra el panel anterior
            RivieraObject objParent = obj.GetParent();

            this.DrawObjects((Document doc, Transaction tr, RivieraObject[] objs) => obj.Delete(tr), stack);
            if (objParent != null)
            {
                objParent.Connect(direction, stack);
            }
            else
            {
                var db = App.Riviera.Database.Objects;
                if (db.FirstOrDefault(x => x.Handle.Value == stack.Handle.Value) == null)
                {
                    db.Add(stack);
                }
            }
            //Se regresa el stack como objeto creado
            return(stack);
        }
コード例 #21
0
        internal void RenderArrowInternal(Graphics g, Rectangle dropDownRect, ArrowDirection direction, Brush brush)
        {
            Point point = new Point(dropDownRect.Left + dropDownRect.Width / 2, dropDownRect.Top + dropDownRect.Height / 2);

            Point[] array = null;
            switch (direction)
            {
            case ArrowDirection.Left:
                array = new Point[3]
                {
                    new Point(point.X + 2, point.Y - 6),
                    new Point(point.X + 2, point.Y + 6),
                    new Point(point.X - 4, point.Y)
                };
                break;

            case ArrowDirection.Up:
                array = new Point[3]
                {
                    new Point(point.X - 4, point.Y + 2),
                    new Point(point.X + 4, point.Y + 2),
                    new Point(point.X, point.Y - 2)
                };
                break;

            case ArrowDirection.Right:
                array = new Point[3]
                {
                    new Point(point.X - 2, point.Y - 6),
                    new Point(point.X - 2, point.Y + 6),
                    new Point(point.X + 4, point.Y)
                };
                break;

            default:
                array = new Point[3]
                {
                    new Point(point.X - 4, point.Y - 2),
                    new Point(point.X + 4, point.Y - 2),
                    new Point(point.X, point.Y + 2)
                };
                break;
            }
            g.FillPolygon(brush, array);
        }
コード例 #22
0
 public override void CheckSolution(ArrowDirection arrowDirection)
 {
     orderPressed.Add(arrowDirection);
     //left, up, right, down
     for (int i = 0; i < orderPressed.Count; i++)
     {
         switch (i)
         {
             case 0:
                 if (orderPressed[i] == ArrowDirection.LEFT)
                 {
                     Debug.Log("Left");
                 }
                 else
                     orderPressed.Clear();
                 break;
             case 1:
                 if (orderPressed[i] == ArrowDirection.UP)
                 {
                     Debug.Log("Up");
                 }
                 else
                     orderPressed.Clear();
                 break;
             case 2:
                 if (orderPressed[i] == ArrowDirection.RIGHT)
                 {
                     Debug.Log("Right");
                 }
                 else
                     orderPressed.Clear();
                 break;
             case 3:
                 if (orderPressed[i] == ArrowDirection.DOWN)
                 {
                     this.correct = true;
                 }
                 else
                     orderPressed.Clear();
                 break;
             default:
                 break;
         }
     }
 }
コード例 #23
0
        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripItem item        = e.Item;
            ToolStrip     toolStrip   = e.ToolStrip;
            Graphics      graphics    = e.Graphics;
            bool          rightToLeft = item.RightToLeft == RightToLeft.Yes;

            new SmoothingModeGraphics(graphics);
            this.RenderOverflowBackground(e, rightToLeft);
            bool      flag2 = toolStrip.Orientation == Orientation.Horizontal;
            Rectangle empty = Rectangle.Empty;

            if (rightToLeft)
            {
                empty = new Rectangle(0, item.Height - 8, 10, 5);
            }
            else
            {
                empty = new Rectangle(item.Width - 12, item.Height - 8, 10, 5);
            }
            ArrowDirection direction = flag2 ? ArrowDirection.Down : ArrowDirection.Right;
            int            x         = (!rightToLeft || !flag2) ? 1 : -1;

            empty.Offset(x, 1);
            Color color = toolStrip.Enabled ? this.ColorTable.Fore : SystemColors.ControlDark;

            using (Brush brush = new SolidBrush(color))
            {
                RenderHelperStrip.RenderArrowInternal(graphics, empty, direction, brush);
            }
            if (flag2)
            {
                using (Pen pen = new Pen(color))
                {
                    graphics.DrawLine(pen, (int)(empty.Right - 8), (int)(empty.Y - 2), (int)(empty.Right - 2), (int)(empty.Y - 2));
                    graphics.DrawLine(pen, (int)(empty.Right - 8), (int)(empty.Y - 1), (int)(empty.Right - 2), (int)(empty.Y - 1));
                    return;
                }
            }
            using (Pen pen2 = new Pen(color))
            {
                graphics.DrawLine(pen2, empty.X, empty.Y, empty.X, empty.Bottom - 1);
                graphics.DrawLine(pen2, empty.X, empty.Y + 1, empty.X, empty.Bottom);
            }
        }
コード例 #24
0
ファイル: Template.cs プロジェクト: chantsunman/nUpdate
 public void Draw(Graphics g, ArrowDirection direction, ButtonState state)
 {
     switch (state)
     {
         case ButtonState.Hover:
             DrawHover(g, direction);
             break;
         case ButtonState.Disabled:
             DrawDisabled(g, direction);
             break;
         case ButtonState.Pressed:
             DrawPressed(g, direction);
             break;
         default:
             DrawNormal(g, direction);
             break;
     }
 }
        public RoadBaseAI.TrafficLightState GetLightState(ArrowDirection dir)
        {
            switch (dir)
            {
            case ArrowDirection.Left:
                return(LightLeft);

            case ArrowDirection.Forward:
            default:
                return(LightMain);

            case ArrowDirection.Right:
                return(LightRight);

            case ArrowDirection.Turn:
                return(Constants.ServiceFactory.SimulationService.LeftHandDrive ? LightRight : LightLeft);
            }
        }
コード例 #26
0
ファイル: TourPopover.cs プロジェクト: visdauas/MatterControl
            public ArrowButton(string text, ArrowDirection arrowDirection, ThemeConfig theme, double pointSize = -1)
                : base(text, theme, pointSize)
            {
                var rightArrow = StaticData.Instance.LoadIcon("fa-angle-right_12.png", 10, 10, theme.InvertIcons);

                if (arrowDirection == ArrowDirection.Right)
                {
                    this.Image = rightArrow;
                }
                else
                {
                    var leftArrow = new ImageBuffer(rightArrow).MirrorX();

                    this.Image = leftArrow;
                }

                this.ArrowDirection = arrowDirection;
            }
コード例 #27
0
        private void ReceiveDirection(ArrowDirection direction)
        {
            ArrowInfo arrowInfo = m_ArrowManager.GetClosestArrowInfo(m_MusicPlayer.TimeInBeats);

            if (Mathf.Abs(arrowInfo.delta) > Judgement.Instance.Strictness)
            {
                return;
            }

            if (arrowInfo.direction == direction)
            {
                HandleSingleNote(arrowInfo);
            }
            else if (ArrowDirectionUtility.IsCombination(arrowInfo.direction))
            {
                HandleMultiDirection(arrowInfo, direction);
            }
        }
コード例 #28
0
        /// <summary>
        /// Updates the position of an arrow.
        /// </summary>
        /// <param name="edge">The edge to be updated.</param>
        /// <param name="type">The new type of the arrow.</param>
        public static void UpdateArrowPosition(Edge edge, ArrowDirection type)
        {
            Edge forward = edge.FirstEdge, backward = edge.SecondEdge;

            // Get first and second arrow.
            Path arrow = forward.Arrow, opposite = backward.Arrow;

            // Node centers of this edge.
            Point from = forward.FirstNode.Center, to = forward.SecondNode.Center;

            // Draw a single arrow
            if (type == ArrowDirection.Single)
            {
                // The begining & end points of this single arrow.
                var begin = Shapes.FindPointOnCircle(to, from);
                var end   = Shapes.FindPointOnCircle(from, to);

                arrow.Data = StraightArrow(begin, end);
                return;
            }

            // Draw two single arrows pointing in opposite directions.
            if (type == ArrowDirection.Double)
            {
                // If the second arrow is invsible (since the edge was "Single" before)
                if (opposite.Visibility == Visibility.Hidden)
                {
                    // Show it.
                    opposite.SetValue(UIElement.VisibilityProperty, Visibility.Visible);
                }

                // The begining & end points of the first arrow.
                Point begin1 = FindPointOnCircle(to, from, doubleArrowAngle);
                Point end1   = FindPointOnCircle(from, to, -doubleArrowAngle);

                // The begining & end points of the second arrow.
                Point begin2 = FindPointOnCircle(to, from, -doubleArrowAngle);
                Point end2   = FindPointOnCircle(from, to, doubleArrowAngle);

                arrow.Data    = StraightArrow(begin1, end1);
                opposite.Data = StraightArrow(end2, begin2);
                return;
            }
        }
コード例 #29
0
        /// <summary>
        /// Raises the <see
        /// cref="System.Windows.Forms.ToolStripRenderer.RenderOverflowButtonBackground"/> event.
        /// </summary>
        /// <param name="e">
        /// A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the
        /// event data.
        /// </param>
        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
        {
            base.OnRenderOverflowButtonBackground(e);
            ToolStripItem item = e.Item;

            if ((item.Selected == false) && (item.Pressed == false))
            {
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
                if (colorTable != null)
                {
                    Graphics graphics     = e.Graphics;
                    bool     bRightToLeft = item.RightToLeft == RightToLeft.Yes;

                    bool      bOrientation   = e.ToolStrip.Orientation == Orientation.Horizontal;
                    Rectangle arrowRectangle = Rectangle.Empty;
                    if (bRightToLeft)
                    {
                        arrowRectangle = new Rectangle(0, item.Height - 8, 9, 5);
                    }
                    else
                    {
                        arrowRectangle = new Rectangle(item.Width - 12, item.Height - 8, 9, 5);
                    }

                    ArrowDirection arrowDirection = bOrientation ? ArrowDirection.Down : ArrowDirection.Right;
                    int            x = (bRightToLeft && bOrientation) ? -1 : 1;
                    arrowRectangle.Offset(x, 1);
                    RenderArrowInternal(graphics, arrowRectangle, arrowDirection, colorTable.ToolStripGradientMiddle);
                    arrowRectangle.Offset(-1 * x, -1);
                    RenderArrowInternal(graphics, arrowRectangle, arrowDirection, colorTable.ToolStripText);
                    if (bOrientation)
                    {
                        x = bRightToLeft ? -2 : 0;
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripText, (int)(arrowRectangle.Right - 6), (int)(arrowRectangle.Y - 2), (int)(arrowRectangle.Right - 2), (int)(arrowRectangle.Y - 2));
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripGradientMiddle, (int)((arrowRectangle.Right - 5) + x), (int)(arrowRectangle.Y - 1), (int)((arrowRectangle.Right - 1) + x), (int)(arrowRectangle.Y - 1));
                    }
                    else
                    {
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripText, arrowRectangle.X, arrowRectangle.Y, arrowRectangle.X, arrowRectangle.Bottom - 1);
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripGradientMiddle, arrowRectangle.X + 1, arrowRectangle.Y + 1, arrowRectangle.X + 1, arrowRectangle.Bottom);
                    }
                }
            }
        }
コード例 #30
0
 protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
 {
     if (ThemeConfig.EffectiveTheme != PdnTheme.Aero)
     {
         base.OnRenderSplitButtonBackground(e);
     }
     else
     {
         ToolStripSplitButton item = (ToolStripSplitButton)e.Item;
         Rectangle            rect = new Rectangle(Point.Empty, item.Size);
         this.RenderAeroButtonBackground(e.Graphics, rect, true, item.Selected, item.Pressed, false);
         ArrowDirection arrowDirection = (item.Owner is StatusStrip) ? ArrowDirection.Up : ArrowDirection.Down;
         base.DrawArrow(new ToolStripArrowRenderEventArgs(e.Graphics, item, item.DropDownButtonBounds, this.AeroColorTheme.SplitButtonArrowColor, arrowDirection));
         if (item.Selected || item.Pressed)
         {
             this.DrawAeroSeparator(e.Graphics, new Rectangle(item.DropDownButtonBounds.Left, item.DropDownButtonBounds.Top, 1, item.DropDownButtonBounds.Height));
         }
     }
 }
コード例 #31
0
        public override void Move(ArrowDirection arrowDirection, Drawer drawer)
        {
            if (Parts.Count > 1 && (Parts.Select(x => x.Y).Distinct().Count() == 1 || Parts.Select(p => p.Y).Distinct().Count() == 1))
            {
                ReverseSnakeDirection();
            }


            // update snake parts locations
            var oldSnakeHeadPart = (SnakePart)SnakeHead.Clone();

            // update head part location
            switch (arrowDirection)
            {
            case ArrowDirection.Up:
                SnakeHead.Y -= oldSnakeHeadPart.Height;
                break;

            case ArrowDirection.Down:
                SnakeHead.Y += oldSnakeHeadPart.Height;
                break;

            case ArrowDirection.Right:
                SnakeHead.X += oldSnakeHeadPart.Width;
                break;

            case ArrowDirection.Left:
                SnakeHead.X -= oldSnakeHeadPart.Width;
                break;
            }

            // update tail parts locations
            moveTailParts(oldSnakeHeadPart);

            // graphically draw snake parts
            Draw(drawer);

            if (IsColided)
            {
                FireOnSnakeColided();
                return;
            }
        }
コード例 #32
0
ファイル: WorldEditor.cs プロジェクト: fuj1n/JMC_OmegaMage
        private void Nudge(ArrowDirection direction)
        {
            switch (direction)
            {
            case ArrowDirection.Up:
                if (roomHeight == 0)
                {
                    return;
                }

                currentRoom.RemoveAt(0);
                currentRoom.Add(Enumerable.Repeat(' ', roomWidth).ToList());
                break;

            case ArrowDirection.Down:
                if (roomHeight == 0)
                {
                    return;
                }

                currentRoom.RemoveAt(currentRoom.Count - 1);
                currentRoom.Insert(0, Enumerable.Repeat(' ', roomWidth).ToList());
                break;

            case ArrowDirection.Left:
                foreach (List <char> row in currentRoom)
                {
                    row.RemoveAt(0);
                    row.Add(' ');
                }
                break;

            case ArrowDirection.Right:
                foreach (List <char> row in currentRoom)
                {
                    row.RemoveAt(row.Count - 1);
                    row.Insert(0, ' ');
                }
                break;
            }

            SoftUpdateWorld();
        }
コード例 #33
0
        private ChartArrow CreateArrow(ArrowDirection direction, Color color, float size, int bar, double price)
        {
            double tipPrice = price;
            int    tipBar   = bar;

            switch (direction)
            {
            case ArrowDirection.Up:
                price -= symbol.MinimumTick;
                break;

            case ArrowDirection.Down:
                price += symbol.MinimumTick;
                break;
            }
            var chartArrow = new ChartArrow(color, size, bar, price, tipBar, tipPrice);

            return(chartArrow);
        }
コード例 #34
0
        protected internal virtual void OnPaintScrollBarArrow(TCEventArgs.PaintScrollBarArrowEventArgs e)
        {
            Graphics       graphics       = e.Graphics;
            Rectangle      arrowRectangle = e.ArrowRectangle;
            ControlState   controlState   = e.ControlState;
            ArrowDirection arrowDirection = e.ArrowDirection;
            Orientation    orientation    = e.Orientation;
            bool           enabled        = e.Enabled;
            Color          backNormal     = this.BackNormal;
            Color          begin          = this.Base;
            Color          border         = this.Border;
            Color          innerBorder    = this.InnerBorder;
            Color          fore           = this.Fore;
            bool           changeColor    = false;

            if (enabled)
            {
                switch (controlState)
                {
                case ControlState.Hover:
                    begin = this.BackHover;
                    goto Label_00BD;

                case ControlState.Pressed:
                    begin       = this.BackPressed;
                    changeColor = true;
                    goto Label_00BD;
                }
                begin = this.Base;
            }
            else
            {
                backNormal = this.GetGray(backNormal);
                begin      = this.GetGray(this.Base);
                border     = this.GetGray(border);
                fore       = this.GetGray(fore);
            }
Label_00BD:
            using (new SmoothingModeGraphics(graphics))
            {
                ControlPaintEx.DrawScrollBarArraw(graphics, arrowRectangle, begin, backNormal, border, innerBorder, fore, e.Orientation, arrowDirection, changeColor);
            }
        }
コード例 #35
0
    public float ShowArrow(GameObject markerObject, bool navigatable, ArrowDirection arrowDirection)
    {
        GameObject  arrowObj = GetARObjectOfType(markerObject, ARObject.Type.Arrow);
        ArrowScript arrowsc  = arrowObj.GetComponent <ArrowScript>();

        switch (arrowDirection)
        {
        case ArrowDirection.Up: arrowsc.PointArrowUp(); break;

        case ArrowDirection.Down: arrowsc.PointArrowDown(); break;

        case ArrowDirection.Front: arrowsc.PointToZero(); break;

        default: arrowsc.PointToZero(); break;
        }
        arrowObj.SetActive(true);
        SendLastObject(arrowsc.Type);
        return(arrowObj.transform.localRotation.eulerAngles.z);
    }
コード例 #36
0
        /// <summary>
        /// Picks the riviera sizes.
        /// </summary>
        /// <param name="dir">The arrow direction.</param>
        /// <returns>
        /// The Riviera measure
        /// </returns>
        public override RivieraMeasure[] PickSizes(ArrowDirection dir)
        {
            TabBordeoMenu ctrl = this.Menu as TabBordeoMenu;

            RivieraMeasure[] sizes;
            if (dir == ArrowDirection.FRONT || dir == ArrowDirection.BACK)
            {
                sizes = ctrl.GetLinearPanels().ToArray();
            }
            else if (dir.GetArrowDirectionName().Contains("90"))
            {
                sizes = ctrl.GetL90Panels().ToArray();
            }
            else
            {
                sizes = ctrl.GetL135Panels().ToArray();
            }
            return(sizes);
        }
コード例 #37
0
        /// <summary>
        /// Sows as Linear panel.
        /// </summary>
        /// <param name="doc">The active document.</param>
        /// <param name="tr">The active transaction.</param>
        protected RivieraObject InsertLinearPanel(RivieraObject obj, ArrowDirection direction, params RivieraMeasure[] sizes)
        {
            //1: Se calcula la dirección y orientación del panel
            Point3d end, start;

            if (direction == ArrowDirection.FRONT) //Misma dirección
            {
                if (obj is BordeoLPanelStack)
                {
                    Polyline pl = (obj as BordeoLPanelStack).FirstOrDefault().PanelGeometry;
                    start = obj.End.ToPoint3d();
                    double angle = pl.GetPoint2dAt(2).GetVectorTo(pl.GetPoint2dAt(3)).Angle;
                    end = start.ToPoint2d().ToPoint2dByPolar(1, angle).ToPoint3d();
                }
                else
                {
                    start = obj.End.ToPoint3d();
                    end   = start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle).ToPoint3d();
                }
            }
            else //Se invierte la dirección
            {
                start = obj.Start.ToPoint3d();
                end   = start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle + Math.PI).ToPoint3d();
            }
            //Se convierten los tamaños a tamaños de bordeo
            IEnumerable <PanelMeasure> pSizes = sizes.Select(x => x as PanelMeasure);
            //El panel inferios se usa como distancia base del arreglo de paneles.
            var first = sizes[0] as PanelMeasure;
            //Se crea el panel
            BordeoPanelStack stack = new BordeoPanelStack(start, end, first);

            //Se agregan los tamaños superiores
            for (int i = 1; i < sizes.Length; i++)
            {
                stack.AddPanel(sizes[i] as PanelMeasure);
            }
            //Se dibuja en el plano
            this.DrawObjects(null, stack);
            obj.Connect(direction, stack);
            //Se regresa el stack como objeto creado
            return(stack);
        }
コード例 #38
0
ファイル: Form1.cs プロジェクト: TroogS/CSharpTutorials
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Prüft, ob ein Panel den Rand des Bereichs erreicht hat und ändert ggf die Richtung.
 /// </summary>
 ///
 /// <remarks>   A Beging, 08.12.2020. </remarks>
 ///
 /// <param name="panel">            Das Panel, welches bewegt werden soll. </param>
 /// <param name="panelDirection">   Die neue Richtung des Panels </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 private void CheckDirectionChange(Panel panel, ref ArrowDirection panelDirection)
 {
     if (panelDirection == ArrowDirection.Right && panel.Location.X == _rightBorder)
     {
         panelDirection = ArrowDirection.Down;
     }
     else if (panelDirection == ArrowDirection.Down && panel.Location.Y == _bottomBorder)
     {
         panelDirection = ArrowDirection.Left;
     }
     else if (panelDirection == ArrowDirection.Left && panel.Location.X == _leftBorder)
     {
         panelDirection = ArrowDirection.Up;
     }
     else if (panelDirection == ArrowDirection.Up && panel.Location.Y == _topBorder)
     {
         panelDirection = ArrowDirection.Right;
     }
 }
コード例 #39
0
 private void Form1_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Up)
     {
         _arrowDirection = ArrowDirection.Up;
     }
     else if (e.KeyCode == Keys.Down)
     {
         _arrowDirection = ArrowDirection.Down;
     }
     else if (e.KeyCode == Keys.Left)
     {
         _arrowDirection = ArrowDirection.Left;
     }
     else if (e.KeyCode == Keys.Right)
     {
         _arrowDirection = ArrowDirection.Right;
     }
 }
        private static void AddSegment(GraphicsPath path, int radius, Point p1, Point p2, bool roundP1, bool roundP2, ArrowDirection direction)
        {
            if (roundP1)
            {
                switch (direction)
                {
                    case ArrowDirection.Left:
                        p1.X -= radius;
                        goto Label_005C;

                    case ArrowDirection.Up:
                        p1.Y -= radius;
                        goto Label_005C;

                    case ArrowDirection.Down:
                        p1.Y += radius;
                        goto Label_005C;
                }
                p1.X += radius;
            }
        Label_005C:
            if (roundP2)
            {
                switch (direction)
                {
                    case ArrowDirection.Left:
                        p2.X += radius;
                        goto Label_00B8;

                    case ArrowDirection.Up:
                        p2.Y += radius;
                        goto Label_00B8;

                    case ArrowDirection.Down:
                        p2.Y -= radius;
                        goto Label_00B8;
                }
                p2.X -= radius;
            }
        Label_00B8:
            path.AddLine(p1, p2);
        }
コード例 #41
0
        private void MoveSelectedLines(ArrowDirection dir)
        {
            var text = Text;
            var ss   = SelectionStart;
            var sl   = SelectionLength;
            var a    = Helper.GetLineStart(text, ss);
            var b    = Helper.GetLineEnd(text, ss + Math.Max(0, sl - 1));
            int i; // start of a line
            int j; // end of a line
            int k; // end of a line

            if (dir == ArrowDirection.Up)
            {
                if (a == 0)
                {
                    return;
                }
                i   = Helper.GetLineStart(text, a - 1);
                j   = a - 1;
                k   = b;
                ss -= a - i;
            }
            else
            {
                if (b == text.Length)
                {
                    return;
                }
                i   = a;
                j   = b;
                k   = Helper.GetLineEnd(text, b + 1);
                ss += k + 1 - (j + 1); // Length of 'v' below.
            }
            var l = Math.Min(k + 1, text.Length);

            Select(i, l - i);
            var u = text.Substring(i, j + 1 - i);
            var v = text.Substring(j + 1, k - (j + 1)) + "\n";

            SelectedText = v + u;
            Select(ss, sl);
        }
コード例 #42
0
        private void DrawScrollBar(IntPtr maskHWnd, Rectangle bounds, Rectangle trackRect, Rectangle topLeftArrowRect, Rectangle bottomRightArrowRect, Rectangle thumbRect, ControlState topLeftArrowState, ControlState bottomRightArrowState, ControlState thumbState, Orientation direction)
        {
            bool            flag    = direction == Orientation.Horizontal;
            bool            enabled = this._owner.Enabled;
            IScrollBarPaint paint   = this._owner as IScrollBarPaint;

            if (paint != null)
            {
                ImageDc dc = new ImageDc(bounds.Width, bounds.Height);
                IntPtr  dC = Win32.NativeMethods.GetDC(maskHWnd);
                try
                {
                    using (Graphics graphics = Graphics.FromHdc(dc.Hdc))
                    {
                        using (TCEventArgs.PaintScrollBarTrackEventArgs args = new TCEventArgs.PaintScrollBarTrackEventArgs(graphics, trackRect, direction, enabled))
                        {
                            paint.OnPaintScrollBarTrack(args);
                        }
                        ArrowDirection arrowDirection = flag ? ArrowDirection.Left : ArrowDirection.Up;
                        using (TCEventArgs.PaintScrollBarArrowEventArgs args2 = new TCEventArgs.PaintScrollBarArrowEventArgs(graphics, topLeftArrowRect, topLeftArrowState, arrowDirection, direction, enabled))
                        {
                            paint.OnPaintScrollBarArrow(args2);
                        }
                        arrowDirection = flag ? ArrowDirection.Right : ArrowDirection.Down;
                        using (TCEventArgs.PaintScrollBarArrowEventArgs args3 = new TCEventArgs.PaintScrollBarArrowEventArgs(graphics, bottomRightArrowRect, bottomRightArrowState, arrowDirection, direction, enabled))
                        {
                            paint.OnPaintScrollBarArrow(args3);
                        }
                        using (TCEventArgs.PaintScrollBarThumbEventArgs args4 = new TCEventArgs.PaintScrollBarThumbEventArgs(graphics, thumbRect, thumbState, direction, enabled))
                        {
                            paint.OnPaintScrollBarThumb(args4);
                        }
                    }
                    Win32.NativeMethods.BitBlt(dC, 0, 0, bounds.Width, bounds.Height, dc.Hdc, 0, 0, 0xcc0020);
                }
                finally
                {
                    Win32.NativeMethods.ReleaseDC(maskHWnd, dC);
                    dc.Dispose();
                }
            }
        }
コード例 #43
0
ファイル: RenderHelper.cs プロジェクト: piaolingzxh/Justin
        internal static void RenderArrowInternal(
            Graphics g,
            Rectangle dropDownRect,
            ArrowDirection direction,
            Brush brush)
        {
            Point point = new Point(
                dropDownRect.Left + (dropDownRect.Width / 2),
                dropDownRect.Top + (dropDownRect.Height / 2));
            Point[] points = null;
            switch (direction)
            {
                case ArrowDirection.Left:
                    points = new Point[] {
                        new Point(point.X + 1, point.Y - 4),
                        new Point(point.X + 1, point.Y + 4),
                        new Point(point.X - 2, point.Y) };
                    break;

                case ArrowDirection.Up:
                    points = new Point[] {
                        new Point(point.X - 4, point.Y + 1),
                        new Point(point.X + 4, point.Y + 1),
                        new Point(point.X, point.Y - 2) };
                    break;

                case ArrowDirection.Right:
                    points = new Point[] {
                        new Point(point.X - 2, point.Y - 4),
                        new Point(point.X - 2, point.Y + 4),
                        new Point(point.X + 1, point.Y) };
                    break;

                default:
                    points = new Point[] {
                        new Point(point.X - 4, point.Y - 1),
                        new Point(point.X + 4, point.Y - 1),
                        new Point(point.X, point.Y + 2) };
                    break;
            }
            g.FillPolygon(brush, points);
        }
        private static void AddRoundedCorner(GraphicsPath path, int diameter, Point midPoint, ArrowDirection direction1, ArrowDirection direction2)
        {
            switch (direction1)
            {
                case ArrowDirection.Left:
                    if (direction2 != ArrowDirection.Down)
                    {
                        path.AddArc(midPoint.X, midPoint.Y - diameter, diameter, diameter, 90f, 90f);
                        return;
                    }
                    path.AddArc(midPoint.X, midPoint.Y, diameter, diameter, 270f, -90f);
                    return;

                case ArrowDirection.Up:
                    if (direction2 != ArrowDirection.Left)
                    {
                        path.AddArc(midPoint.X, midPoint.Y, diameter, diameter, 180f, 90f);
                        return;
                    }
                    path.AddArc(midPoint.X - diameter, midPoint.Y, diameter, diameter, 0f, -90f);
                    return;

                case ArrowDirection.Right:
                    if (direction2 == ArrowDirection.Down)
                    {
                        path.AddArc(midPoint.X - diameter, midPoint.Y, diameter, diameter, 270f, 90f);
                        return;
                    }
                    path.AddArc(midPoint.X - diameter, midPoint.Y - diameter, diameter, diameter, 90f, -90f);
                    return;
            }
            if (direction2 == ArrowDirection.Left)
            {
                path.AddArc(midPoint.X - diameter, midPoint.Y - diameter, diameter, diameter, 0f, 90f);
            }
            else
            {
                path.AddArc(midPoint.X, midPoint.Y - diameter, diameter, diameter, 180f, -90f);
            }
        }
コード例 #45
0
        public virtual ToolStripItem GetNextItem(ToolStripItem start, ArrowDirection direction)
        {
            if (!WindowsFormsUtils.EnumValidator.IsValidArrowDirection(direction))
            {
                throw new InvalidEnumArgumentException("direction", (int) direction, typeof(ArrowDirection));
            }
            switch (direction)
            {
                case ArrowDirection.Left:
                    return this.GetNextItemHorizontal(start, false);

                case ArrowDirection.Up:
                    return this.GetNextItemVertical(start, false);

                case ArrowDirection.Right:
                    return this.GetNextItemHorizontal(start, true);

                case ArrowDirection.Down:
                    return this.GetNextItemVertical(start, true);
            }
            return null;
        }
コード例 #46
0
ファイル: BseRenderer.cs プロジェクト: mikhp/greatmaps
        /// <summary>
        /// Renders the arrows in the OverflowButton.
        /// </summary>
        /// <param name="graphics">The Graphics to draw on.</param>
        /// <param name="dropDownRectangle">The rectangle in which the arrows should drawn.</param>
        /// <param name="direction">the direction of the arrows.</param>
        /// <param name="color">The color used to fill the arrow polygons</param>
        private static void RenderArrowInternal(Graphics graphics, Rectangle dropDownRectangle, ArrowDirection direction, Color color)
        {
            Point point = new Point(dropDownRectangle.Left + (dropDownRectangle.Width / 2), dropDownRectangle.Top + (dropDownRectangle.Height / 2));
            point.X += dropDownRectangle.Width % 2;
            Point[] points = null;
            switch (direction)
            {
                case ArrowDirection.Left:
                    points = new Point[] { new Point(point.X + 2, point.Y - 3), new Point(point.X + 2, point.Y + 3), new Point(point.X - 1, point.Y) };
                    break;

                case ArrowDirection.Up:
                    points = new Point[] { new Point(point.X - 2, point.Y + 1), new Point(point.X + 3, point.Y + 1), new Point(point.X, point.Y - 2) };
                    break;

                case ArrowDirection.Right:
                    points = new Point[] { new Point(point.X - 2, point.Y - 3), new Point(point.X - 2, point.Y + 3), new Point(point.X + 1, point.Y) };
                    break;

                default:
                    points = new Point[] { new Point(point.X - 2, point.Y - 1), new Point(point.X + 3, point.Y - 1), new Point(point.X, point.Y + 2) };
                    break;
            }
            using (SolidBrush backBrush = new SolidBrush(color))
            {
                graphics.FillPolygon(backBrush, points);
            }
        }
コード例 #47
0
ファイル: SkinComboBox.cs プロジェクト: jxdong1013/archivems
 internal void RenderScrollBarArrowInternal(Graphics g, Rectangle rect, Color baseColor, Color borderColor, Color innerBorderColor, Color arrowColor, RoundStyle roundStyle, bool drawBorder, bool drawGlass, ArrowDirection arrowDirection, LinearGradientMode mode)
 {
     RenderHelper.RenderBackgroundInternal(g, rect, baseColor, borderColor, innerBorderColor, roundStyle, 0, 0.45f, drawBorder, drawGlass, mode);
     using (SolidBrush brush = new SolidBrush(arrowColor))
     {
         this.RenderArrowInternal(g, rect, arrowDirection, brush);
     }
 }
コード例 #48
0
ファイル: AeroTemplate.cs プロジェクト: chantsunman/nUpdate
            protected override void DrawPressed(Graphics g, ArrowDirection direction)
            {
                g.FillPath(_pressedBackgrounBrush, _lowerBackgroundPath);
                g.FillPath(_pressedUpperBackgroundBrush, _upperBackgroundPath);
                g.FillEllipse(_pressedLowerBackgroundBrush, _backgroundRect);

                if (direction == ArrowDirection.Right)
                    g.MultiplyTransform(new Matrix(-1, 0, 0, 1, 24f, 0));
                g.DrawPath(_normalArrowPen, _arrowPath);
            }
コード例 #49
0
        private GraphicsPath CreateArrowPath(ToolStripItem item,
                                             Rectangle rect,
                                             ArrowDirection direction)
        {
            int x, y;

            // Find the correct starting position, which depends on direction
            if ((direction == ArrowDirection.Left) ||
                (direction == ArrowDirection.Right))
            {
                x = rect.Right - (rect.Width - 4)/2;
                y = rect.Y + rect.Height/2;
            }
            else
            {
                x = rect.X + rect.Width/2;
                y = rect.Bottom - (rect.Height - 3)/2;

                // The drop down button is position 1 pixel incorrectly when in RTL
                if ((item is ToolStripDropDownButton) &&
                    (item.RightToLeft == RightToLeft.Yes))
                    x++;
            }

            // Create triangle using a series of lines
            GraphicsPath path = new GraphicsPath();

            switch (direction)
            {
                case ArrowDirection.Right:
                    path.AddLine(x, y, x - 4, y - 4);
                    path.AddLine(x - 4, y - 4, x - 4, y + 4);
                    path.AddLine(x - 4, y + 4, x, y);
                    break;
                case ArrowDirection.Left:
                    path.AddLine(x - 4, y, x, y - 4);
                    path.AddLine(x, y - 4, x, y + 4);
                    path.AddLine(x, y + 4, x - 4, y);
                    break;
                case ArrowDirection.Down:
                    path.AddLine(x + 3f, y - 3f, x - 2f, y - 3f);
                    path.AddLine(x - 2f, y - 3f, x, y);
                    path.AddLine(x, y, x + 3f, y - 3f);
                    break;
                case ArrowDirection.Up:
                    path.AddLine(x + 3f, y, x - 3f, y);
                    path.AddLine(x - 3f, y, x, y - 4f);
                    path.AddLine(x, y - 4f, x + 3f, y);
                    break;
            }

            return path;
        }
コード例 #50
0
 private static void AddRoundedCorner(GraphicsPath path, int diameter, Point midPoint, ArrowDirection direction1, ArrowDirection direction2)
 {
     switch (direction1)
     {
         case ArrowDirection.Left:
             if (direction2 == ArrowDirection.Down)
                 path.AddArc(midPoint.X, midPoint.Y, diameter, diameter, 270f, -90f);
             else
                 path.AddArc(midPoint.X, midPoint.Y - diameter, diameter, diameter, 90f, 90f);
             break;
         case ArrowDirection.Right:
             if (direction2 == ArrowDirection.Down)
                 path.AddArc(midPoint.X - diameter, midPoint.Y, diameter, diameter, 270f, 90f);
             else
                 path.AddArc(midPoint.X - diameter, midPoint.Y - diameter, diameter, diameter, 90f, -90f);
             break;
         case ArrowDirection.Up:
             if (direction2 == ArrowDirection.Left)
                 path.AddArc(midPoint.X - diameter, midPoint.Y, diameter, diameter, 0f, -90f);
             else
                 path.AddArc(midPoint.X, midPoint.Y, diameter, diameter, 180f, 90f);
             break;
         default:
             if (direction2 == ArrowDirection.Left)
                 path.AddArc(midPoint.X - diameter, midPoint.Y - diameter, diameter, diameter, 0f, 90f);
             else
                 path.AddArc(midPoint.X, midPoint.Y - diameter, diameter, diameter, 180f, -90f);
             break;
     }
 }
コード例 #51
0
 private static void AddSegment(GraphicsPath path, int radius, Point p1, Point p2, bool roundP1, bool roundP2, ArrowDirection direction)
 {
     if (roundP1)
     {
         switch (direction)
         {
             case ArrowDirection.Down:
                 p1.Y += radius;
                 break;
             case ArrowDirection.Up:
                 p1.Y -= radius;
                 break;
             case ArrowDirection.Left:
                 p1.X -= radius;
                 break;
             default:
                 p1.X += radius;
                 break;
         }
     }
     if (roundP2)
     {
         switch (direction)
         {
             case ArrowDirection.Down:
                 p2.Y -= radius;
                 break;
             case ArrowDirection.Up:
                 p2.Y += radius;
                 break;
             case ArrowDirection.Left:
                 p2.X += radius;
                 break;
             default:
                 p2.X -= radius;
                 break;
         }
     }
     path.AddLine(p1, p2);
 }
 private ToolStripItem GetNextItem(ToolStrip parent, ToolStripItem startItem, ArrowDirection direction)
 {
     if ((parent.RightToLeft == RightToLeft.Yes) && ((direction == ArrowDirection.Left) || (direction == ArrowDirection.Right)))
     {
         if (direction == ArrowDirection.Right)
         {
             direction = ArrowDirection.Left;
         }
         else if (direction == ArrowDirection.Left)
         {
             direction = ArrowDirection.Right;
         }
     }
     return parent.GetNextItem(startItem, direction);
 }
コード例 #53
0
ファイル: ToolStrip.cs プロジェクト: nekresh/mono
		public virtual ToolStripItem GetNextItem (ToolStripItem start, ArrowDirection direction)
		{
			if (!Enum.IsDefined (typeof (ArrowDirection), direction))
				throw new InvalidEnumArgumentException (string.Format ("Enum argument value '{0}' is not valid for ArrowDirection", direction));

			ToolStripItem current_best = null;
			int current_best_point;
			
			switch (direction) {
				case ArrowDirection.Right:
					current_best_point = int.MaxValue;

					if (start != null)
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Left >= start.Right && loop_tsi.Left < current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Left;
							}
							
					if (current_best == null)
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Left < current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Left;
							}
							
					break;
				case ArrowDirection.Up:
					current_best_point = int.MinValue;

					if (start != null)
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Bottom <= start.Top && loop_tsi.Top > current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Top;
							}

					if (current_best == null)
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Top > current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Top;
							}

					break;
				case ArrowDirection.Left:
					current_best_point = int.MinValue;

					if (start != null)
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Right <= start.Left && loop_tsi.Left > current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Left;
							}

					if (current_best == null)
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Left > current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Left;
							}

					break;
				case ArrowDirection.Down:
					current_best_point = int.MaxValue;

					if (start != null) 
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Top >= start.Bottom && loop_tsi.Bottom < current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Top;
							}

					if (current_best == null)
						foreach (ToolStripItem loop_tsi in this.DisplayedItems)
							if (loop_tsi.Top < current_best_point && loop_tsi.Visible && loop_tsi.CanSelect) {
								current_best = loop_tsi;
								current_best_point = loop_tsi.Top;
							}

					break;
			}

			return current_best;
		}
コード例 #54
0
 internal virtual ToolStripItem GetNextItem(ToolStripItem start, ArrowDirection direction, bool rtlAware)
 {
     if (rtlAware && (this.RightToLeft == RightToLeft.Yes))
     {
         if (direction == ArrowDirection.Right)
         {
             direction = ArrowDirection.Left;
         }
         else if (direction == ArrowDirection.Left)
         {
             direction = ArrowDirection.Right;
         }
     }
     return this.GetNextItem(start, direction);
 }
コード例 #55
0
ファイル: EasyRenderBase.cs プロジェクト: nicholatian/monody
        /// <summary>
        /// Creates a triangle based on the size and bounds sectors
        /// </summary>
        /// <param name="Bounds">The area which the triangle is confined to</param>
        /// <param name="Size">The size of the triangle</param>
        /// <param name="Direction">The direction which the triangle is pointing</param>
        /// <returns></returns>
        private GraphicsPath CreateTrianglePath(Rectangle Bounds, Int32 Size, ArrowDirection Direction)
        {
            GraphicsPath Result = new GraphicsPath();
            int x, y, c, j;

            if (Direction == ArrowDirection.Left || Direction == ArrowDirection.Right)
            {
                x = Bounds.Right - (Bounds.Width - Size) / 2;
                y = Bounds.Y + Bounds.Height / 2;
                c = Size;
                j = 0;
            }
            else
            {
                x = Bounds.X + Bounds.Width / 2;
                y = Bounds.Bottom - ((Bounds.Height - (Size - 1)) / 2);
                c = Size - 1;
                j = Size - 2;
            }

            switch (Direction)
            {
                case ArrowDirection.Right:
                    Result.AddLine(x, y, x - c, y - c);
                    Result.AddLine(x - c, y - c, x - c, y + c);
                    Result.AddLine(x - c, y + c, x, y);
                    break;
                case ArrowDirection.Down:
                    Result.AddLine(x + j, y - j, x - j, y - j);
                    Result.AddLine(x - j, y - j, x, y);
                    Result.AddLine(x, y, x + j, y - j);
                    break;
                case ArrowDirection.Left:
                    Result.AddLine(x - c, y, x, y - c);
                    Result.AddLine(x, y - c, x, y + c);
                    Result.AddLine(x, y + c, x - c, y);
                    break;
            }

            return Result;
        }
コード例 #56
0
ファイル: Events.cs プロジェクト: Nicologies/QTTabBar
 public QEventArgs(ArrowDirection arrowDir)
 {
     this.arrowDir = arrowDir;
 }
コード例 #57
0
ファイル: AeroTemplate.cs プロジェクト: chantsunman/nUpdate
            protected override void DrawDisabled(Graphics g, ArrowDirection direction)
            {
                g.FillPath(_disabledUpperBackgroundBrush, _upperBackgroundPath);
                g.FillPath(_disabledLowerBackgroundBrush, _lowerBackgroundPath);
                g.FillPath(_disabledUpperBrush, _upperBackgroundPath);
                g.FillPath(_disabledLowerBrush, _lowerBackgroundPath);

                if (direction == ArrowDirection.Right)
                    g.MultiplyTransform(new Matrix(-1, 0, 0, 1, 24f, 0));
                g.DrawPath(_disabledArrowPen, _arrowPath);
            }
コード例 #58
0
        public void RenderArrowInternal(Graphics g, Rectangle dropDownRect, ArrowDirection direction, Brush brush)
        {
            System.Drawing.Point point = new System.Drawing.Point(dropDownRect.Left + (dropDownRect.Width / 2), dropDownRect.Top + (dropDownRect.Height / 2));
            System.Drawing.Point[] points = null;
            switch (direction)
            {
                case ArrowDirection.Left:
                    points = new System.Drawing.Point[] { new System.Drawing.Point(point.X + 2, point.Y - 3), new System.Drawing.Point(point.X + 2, point.Y + 3), new System.Drawing.Point(point.X - 1, point.Y) };
                    break;

                case ArrowDirection.Up:
                    points = new System.Drawing.Point[] { new System.Drawing.Point(point.X - 3, point.Y + 1), new System.Drawing.Point(point.X + 3, point.Y + 1), new System.Drawing.Point(point.X, point.Y - 1) };
                    break;

                case ArrowDirection.Right:
                    points = new System.Drawing.Point[] { new System.Drawing.Point(point.X - 2, point.Y - 3), new System.Drawing.Point(point.X - 2, point.Y + 3), new System.Drawing.Point(point.X + 1, point.Y) };
                    break;

                default:
                    points = new System.Drawing.Point[] { new System.Drawing.Point(point.X - 3, point.Y - 1), new System.Drawing.Point(point.X + 3, point.Y - 1), new System.Drawing.Point(point.X, point.Y + 1) };
                    break;
            }
            g.FillPolygon(brush, points);
        }
コード例 #59
0
 public void RenderButton(Graphics g, Rectangle rect, Color baseColor, Color borderColor, Color arrowColor, ArrowDirection direction)
 {
     this.RenderBackgroundInternal(g, rect, baseColor, borderColor, 0.45f, true, LinearGradientMode.Vertical);
     using (SolidBrush brush = new SolidBrush(arrowColor))
     {
         this.RenderArrowInternal(g, rect, direction, brush);
     }
 }
コード例 #60
0
ファイル: ControlPaintEx.cs プロジェクト: piaolingzxh/Justin
        public static void DrawScrollBarArraw(
            Graphics g,
            Rectangle rect,
            Color begin,
            Color end,
            Color border,
            Color innerBorder,
            Color fore,
            Orientation orientation,
            ArrowDirection arrowDirection,
            bool changeColor)
        {
            if (changeColor)
            {
                Color tmp = begin;
                begin = end;
                end = tmp;
            }

            bool bHorizontal = orientation == Orientation.Horizontal;
            LinearGradientMode mode = bHorizontal ?
                LinearGradientMode.Vertical : LinearGradientMode.Horizontal;

            rect.Inflate(-1, -1);

            Blend blend = new Blend();
            blend.Factors = new float[] { 1f, 0.5f, 0f };
            blend.Positions = new float[] { 0f, 0.5f, 1f };

            DrawGradientRoundRect(
                g,
                rect,
                begin,
                end,
                border,
                innerBorder,
                blend,
                mode,
                4,
                RoundStyle.All,
                true,
                true);

            using (SolidBrush brush = new SolidBrush(fore))
            {
                RenderHelper.RenderArrowInternal(
                    g,
                    rect,
                    arrowDirection,
                    brush);
            }
        }