/// <summary>
        /// Gets the tick positions.
        /// </summary>
        /// <param name="axis">The axis.</param>
        /// <param name="tickStyle">The tick style.</param>
        /// <param name="tickSize">The tick size.</param>
        /// <param name="position">The position.</param>
        /// <param name="x0">The x 0.</param>
        /// <param name="x1">The x 1.</param>
        protected virtual void GetTickPositions(AxisBase axis, TickStyle tickStyle, double tickSize, AxisPosition position, out double x0, out double x1)
        {
            x0 = 0;
            x1 = 0;
            var isTopOrLeft = position == AxisPosition.Top || position == AxisPosition.Left;
            var sign        = isTopOrLeft ? -1 : 1;

            switch (tickStyle)
            {
            case TickStyle.Crossing:
                x0 = -tickSize * sign * 0.75;
                x1 = tickSize * sign * 0.75;
                break;

            case TickStyle.Inside:
                x0 = -tickSize * sign;
                break;

            case TickStyle.Outside:
                x1 = tickSize * sign;
                break;

            case TickStyle.None:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(tickStyle), tickStyle, null);
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="paintParams"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para>
        /// </exception>
        public void DrawTrack(NuGenTrackBarPaintParams paintParams)
        {
            if (paintParams == null)
            {
                throw new ArgumentNullException("paintParams");
            }

            Graphics           g            = paintParams.Graphics;
            Rectangle          bounds       = paintParams.Bounds;
            NuGenControlState  state        = paintParams.State;
            TickStyle          tickStyle    = paintParams.TickStyle;
            INuGenValueTracker valueTracker = paintParams.ValueTracker;

            /* Track */

            Rectangle valueRect = new Rectangle(
                bounds.Left,
                bounds.Top,
                (int)(NuGenSmoothTrackBarRenderer.GetStep(bounds, valueTracker) * (valueTracker.Value - valueTracker.Minimum)),
                bounds.Height
                );

            if (
                valueRect.Width > 0 &&
                valueRect.Height > 0
                )
            {
                this.DrawBackground(
                    g,
                    valueRect,
                    state == NuGenControlState.Normal || state == NuGenControlState.Focused ? NuGenControlState.Hot : state
                    );
            }

            this.DrawBorder(g, bounds, state);

            /* TickLines */

            if ((tickStyle & TickStyle.BottomRight) > 0)
            {
                this.DrawTickLines(
                    g,
                    NuGenSmoothTrackBarRenderer.GetTickLinesBounds(bounds, TickStyle.BottomRight),
                    state,
                    TickStyle.BottomRight,
                    valueTracker
                    );
            }

            if ((tickStyle & TickStyle.TopLeft) > 0)
            {
                this.DrawTickLines(
                    g,
                    NuGenSmoothTrackBarRenderer.GetTickLinesBounds(bounds, TickStyle.TopLeft),
                    state,
                    TickStyle.TopLeft,
                    valueTracker
                    );
            }
        }
        /*
         * GetTickLinesBounds
         */

        private static Rectangle GetTickLinesBounds(Rectangle trackBounds, TickStyle tickStyle)
        {
            Rectangle rect            = Rectangle.Empty;
            int       tickLinesHeight = trackBounds.Height * 3;

            if (tickStyle == TickStyle.BottomRight)
            {
                rect = new Rectangle(
                    trackBounds.Left,
                    trackBounds.Bottom + tickLinesHeight,
                    trackBounds.Width,
                    trackBounds.Height
                    );
            }
            else if (tickStyle == TickStyle.TopLeft)
            {
                rect = new Rectangle(
                    trackBounds.Left,
                    trackBounds.Top - trackBounds.Height - tickLinesHeight,
                    trackBounds.Width,
                    trackBounds.Height
                    );
            }

            return(rect);
        }
Beispiel #4
0
        private static PlotModel CreateTickStyleModel(TickStyle tickStyle)
        {
            var model = new PlotModel {
                Title = "TickStyle: " + tickStyle
            };

            model.Axes.Add(new LinearAxis
            {
                Position           = AxisPosition.Bottom,
                TickStyle          = tickStyle,
                MajorGridlineStyle = LineStyle.None,
                MinorGridlineStyle = LineStyle.None,
                MaximumPadding     = 0,
                MinimumPadding     = 0
            });
            model.Axes.Add(new LinearAxis
            {
                Position           = AxisPosition.Left,
                TickStyle          = tickStyle,
                MajorGridlineStyle = LineStyle.None,
                MinorGridlineStyle = LineStyle.None,
                MaximumPadding     = 0,
                MinimumPadding     = 0
            });
            return(model);
        }
Beispiel #5
0
        public TrackBar()
        {
            orientation              = Orientation.Horizontal;
            minimum                  = 0;
            maximum                  = 10;
            tickFrequency            = 1;
            autosize                 = true;
            position                 = 0;
            tickStyle                = TickStyle.BottomRight;
            smallChange              = 1;
            largeChange              = 5;
            mouse_clickmove          = false;
            MouseDown               += new MouseEventHandler(OnMouseDownTB);
            MouseUp                 += new MouseEventHandler(OnMouseUpTB);
            MouseMove               += new MouseEventHandler(OnMouseMoveTB);
            MouseLeave              += new EventHandler(OnMouseLeave);
            KeyDown                 += new KeyEventHandler(OnKeyDownTB);
            LostFocus               += new EventHandler(OnLostFocusTB);
            GotFocus                += new EventHandler(OnGotFocusTB);
            holdclick_timer.Elapsed += new ElapsedEventHandler(OnFirstClickTimer);

            SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque
#if NET_2_0
                     | ControlStyles.UseTextForAccessibility
#endif
                     , false);
        }
 /// <summary>
 /// Creates an example with the specified <see cref="TickStyle" />.
 /// </summary>
 /// <param name="tickStyle">The tick style.</param>
 /// <returns>A <see cref="PlotModel" />.</returns>
 private static PlotModel CreateTickStyleExample(TickStyle tickStyle)
 {
     var plotModel1 = new PlotModel { Title = "TickStyle = " + tickStyle };
     plotModel1.Axes.Add(new LinearAxis { Position = AxisPosition.Left, TickStyle = tickStyle });
     plotModel1.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, TickStyle = tickStyle });
     return plotModel1;
 }
Beispiel #7
0
 private static TrackBar MakeTrackBar(TickStyle tickStyle)
 {
     return(new TrackBar
     {
         Orientation = Orientation.Vertical, TickStyle = tickStyle, Dock = DockStyle.Left,
         Padding = Padding.Empty, Margin = Padding.Empty
     });
 }
Beispiel #8
0
    public void Init()
    {
        if (this.m_AddedCurves != null)
        {
            return;
        }
        this.m_AddedCurves = new List <ParticleSystemCurveEditor.CurveData>();
        this.m_Colors      = new Color[]
        {
            new Color(1f, 0.619607866f, 0.129411772f),
            new Color(0.8745098f, 0.211764708f, 0.5803922f),
            new Color(0f, 0.6862745f, 1f),
            new Color(1f, 0.921568632f, 0f),
            new Color(0.196078435f, 1f, 0.266666681f),
            new Color(0.980392158f, 0f, 0f)
        };
        this.m_AvailableColors = new List <Color>(this.m_Colors);
        ParticleSystemCurveEditor.m_CurveEditorSettings.useFocusColors   = true;
        ParticleSystemCurveEditor.m_CurveEditorSettings.showAxisLabels   = false;
        ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin        = 0f;
        ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin        = 0f;
        ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMax        = 1f;
        ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax        = 1f;
        ParticleSystemCurveEditor.m_CurveEditorSettings.vSlider          = false;
        ParticleSystemCurveEditor.m_CurveEditorSettings.hSlider          = false;
        ParticleSystemCurveEditor.m_CurveEditorSettings.wrapColor        = new Color(0f, 0f, 0f, 0f);
        ParticleSystemCurveEditor.m_CurveEditorSettings.hTickLabelOffset = 5f;
        ParticleSystemCurveEditor.m_CurveEditorSettings.allowDraggingCurvesAndRegions = true;
        ParticleSystemCurveEditor.m_CurveEditorSettings.allowDeleteLastKeyInCurve     = false;
        TickStyle tickStyle = new TickStyle();

        tickStyle.color       = new Color(0f, 0f, 0f, 0.2f);
        tickStyle.distLabel   = 30;
        tickStyle.stubs       = false;
        tickStyle.centerLabel = true;
        ParticleSystemCurveEditor.m_CurveEditorSettings.hTickStyle = tickStyle;
        TickStyle tickStyle2 = new TickStyle();

        tickStyle2.color       = new Color(0f, 0f, 0f, 0.2f);
        tickStyle2.distLabel   = 20;
        tickStyle2.stubs       = false;
        tickStyle2.centerLabel = true;
        ParticleSystemCurveEditor.m_CurveEditorSettings.vTickStyle = tickStyle2;
        this.m_CurveEditor            = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), this.CreateCurveWrapperArray(), false);
        this.m_CurveEditor.settings   = ParticleSystemCurveEditor.m_CurveEditorSettings;
        this.m_CurveEditor.leftmargin = 40f;
        ZoomableArea arg_2A2_0 = this.m_CurveEditor;
        float        num       = 25f;

        this.m_CurveEditor.bottommargin = num;
        num = num;
        this.m_CurveEditor.topmargin = num;
        arg_2A2_0.rightmargin        = num;
        this.m_CurveEditor.SetShownHRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax);
        this.m_CurveEditor.SetShownVRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax);
        this.m_CurveEditor.ignoreScrollWheelUntilClicked = false;
        Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed));
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="NuGenTrackButtonPaintParams"/> class.
 /// </summary>
 /// <exception cref="ArgumentNullException">
 /// <para>
 ///		<paramref name="sender"/> is <see langword="null"/>.
 /// </para>
 /// -or-
 /// <para>
 ///		<paramref name="g"/> is <see langword="null"/>.
 /// </para>
 /// </exception>
 public NuGenTrackButtonPaintParams(
     object sender,
     Graphics g,
     Rectangle bounds,
     NuGenControlState state,
     TickStyle style
     )
     : base(sender, g, bounds, state)
 {
     _style = style;
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenTrackButtonPaintParams"/> class.
		/// </summary>
		/// <exception cref="ArgumentNullException">
		/// <para>
		///		<paramref name="sender"/> is <see langword="null"/>.
		/// </para>
		/// -or-
		/// <para>
		///		<paramref name="g"/> is <see langword="null"/>.
		/// </para>
		/// </exception>
		public NuGenTrackButtonPaintParams(
			object sender,
			Graphics g,
			Rectangle bounds,
			NuGenControlState state,
			TickStyle style
			)
			: base(sender,  g, bounds, state)
		{
			_style = style;
		}
        /// <summary>
        /// </summary>
        /// <param name="paintParams"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para>
        /// </exception>
        public void DrawTrackButton(NuGenTrackButtonPaintParams paintParams)
        {
            if (paintParams == null)
            {
                throw new ArgumentNullException("paintParams");
            }

            Graphics          g         = paintParams.Graphics;
            Rectangle         bounds    = paintParams.Bounds;
            NuGenControlState state     = paintParams.State;
            TickStyle         tickStyle = paintParams.Style;

            Rectangle borderRectangle = NuGenControlPaint.BorderRectangle(bounds);

            using (NuGenGrfxMode mode = new NuGenGrfxMode(g))
            {
                g.SmoothingMode = SmoothingMode.AntiAlias;

                using (GraphicsPath gp = NuGenSmoothTrackBarRenderer.GetGraphicsPath(borderRectangle, tickStyle))
                {
                    /* Background */

                    using (
                        Brush brush = this.GetBackgroundBrush(
                            borderRectangle,
                            state == NuGenControlState.Normal || state == NuGenControlState.Focused
                                                                        ? NuGenControlState.Hot
                                                                        : state
                            )
                        )
                    {
                        g.FillPath(brush, gp);
                    }

                    /* Body */

                    Rectangle bodyRectangle = Rectangle.Inflate(borderRectangle, 0, -3);

                    using (GraphicsPath bgp = NuGenSmoothTrackBarRenderer.GetBodyGraphicsPath(borderRectangle, tickStyle))
                        using (Brush brush = this.GetBackgroundBrush(bodyRectangle, state))
                        {
                            g.FillPath(brush, bgp);
                        }

                    /* Border */

                    using (Pen pen = this.GetBorderPen(state))
                    {
                        g.DrawPath(pen, gp);
                    }
                }
            }
        }
 public void Init()
 {
     if (this.m_AddedCurves == null)
     {
         this.m_AddedCurves = new List<CurveData>();
         this.m_Colors = new Color[] { new Color(1f, 0.6196079f, 0.1294118f), new Color(0.8745098f, 0.2117647f, 0.5803922f), new Color(0f, 0.6862745f, 1f), new Color(1f, 0.9215686f, 0f), new Color(0.1960784f, 1f, 0.2666667f), new Color(0.9803922f, 0f, 0f) };
         this.m_AvailableColors = new List<Color>(this.m_Colors);
         m_CurveEditorSettings.useFocusColors = true;
         m_CurveEditorSettings.showAxisLabels = false;
         m_CurveEditorSettings.hRangeMin = 0f;
         m_CurveEditorSettings.vRangeMin = 0f;
         m_CurveEditorSettings.vRangeMax = 1f;
         m_CurveEditorSettings.hRangeMax = 1f;
         m_CurveEditorSettings.vSlider = false;
         m_CurveEditorSettings.hSlider = false;
         m_CurveEditorSettings.showWrapperPopups = true;
         m_CurveEditorSettings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool;
         m_CurveEditorSettings.hTickLabelOffset = 5f;
         m_CurveEditorSettings.allowDraggingCurvesAndRegions = true;
         m_CurveEditorSettings.allowDeleteLastKeyInCurve = false;
         TickStyle style = new TickStyle {
             tickColor = { color = new Color(0f, 0f, 0f, 0.2f) },
             distLabel = 30,
             stubs = false,
             centerLabel = true
         };
         m_CurveEditorSettings.hTickStyle = style;
         TickStyle style2 = new TickStyle {
             tickColor = { color = new Color(0f, 0f, 0f, 0.2f) },
             distLabel = 20,
             stubs = false,
             centerLabel = true
         };
         m_CurveEditorSettings.vTickStyle = style2;
         this.m_CurveEditor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), this.CreateCurveWrapperArray(), false);
         this.m_CurveEditor.settings = m_CurveEditorSettings;
         this.m_CurveEditor.leftmargin = 40f;
         float num = 25f;
         this.m_CurveEditor.bottommargin = num;
         this.m_CurveEditor.topmargin = num;
         this.m_CurveEditor.rightmargin = num;
         this.m_CurveEditor.SetShownHRangeInsideMargins(m_CurveEditorSettings.hRangeMin, m_CurveEditorSettings.hRangeMax);
         this.m_CurveEditor.SetShownVRangeInsideMargins(m_CurveEditorSettings.vRangeMin, m_CurveEditorSettings.hRangeMax);
         this.m_CurveEditor.ignoreScrollWheelUntilClicked = false;
         Undo.undoRedoPerformed = (Undo.UndoRedoCallback) Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed));
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NuGenTrackBarPaintParams"/> class.
        /// </summary>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="sender"/> is <see langword="null"/>.</para>
        /// -or-
        /// <para><paramref name="g"/> is <see langword="null"/>.</para>
        /// -or-
        /// <para><paramref name="valueTracker"/> is <see langword="null"/>.</para>
        /// </exception>
        public NuGenTrackBarPaintParams(
            object sender,
            Graphics g,
            Rectangle bounds,
            NuGenControlState state,
            INuGenValueTracker valueTracker,
            TickStyle tickStyle
            )
            : base(sender, g, bounds, state)
        {
            if (valueTracker == null)
            {
                throw new ArgumentNullException("valueTracker");
            }

            _valueTracker = valueTracker;
            _tickStyle    = tickStyle;
        }
Beispiel #14
0
 /// <summary>
 /// Draws a tick mark at the specified location, according to the specified TickStyle
 /// </summary>
 /// <param name="g"><c>Graphics</c> object to draw on</param>
 /// <param name="coord">The pixel coordinate that corresponds to the tick's value</param>
 /// <param name="tickPen"><c>Pen</c> to draw the tick mark with</param>
 /// <param name="position"><c>TickStyle</c> to draw the tick in</param>
 protected void DrawTick(Graphics g, int coord, Pen tickPen, TickStyle position)
 {
     if (position == TickStyle.Both)
     {
         DrawTick(g, coord, tickPen, TickStyle.TopLeft);
         DrawTick(g, coord, tickPen, TickStyle.BottomRight);
     }
     else if (position == TickStyle.TopLeft)
     {
         if (Orientation == Orientation.Vertical)
         {
             g.DrawLine(tickPen, ClientRectangle.Left + Padding.Left,
                        coord,
                        ClientRectangle.Left + Padding.Left + TrackWidth,
                        coord);
         }
         else
         {
             g.DrawLine(tickPen, coord,
                        ClientRectangle.Top + Padding.Top,
                        coord,
                        ClientRectangle.Top + Padding.Top + TrackWidth);
         }
     }
     else if (position == TickStyle.BottomRight)
     {
         if (Orientation == Orientation.Vertical)
         {
             g.DrawLine(tickPen, ClientRectangle.Width,
                        coord,
                        ClientRectangle.Width - TrackWidth,
                        coord);
         }
         else
         {
             g.DrawLine(tickPen, coord,
                        ClientRectangle.Bottom,
                        coord,
                        ClientRectangle.Bottom - TrackWidth);
         }
     }
 }
Beispiel #15
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawTrackBar class.
        /// </summary>
        /// <param name="stateNormal">Referenece to normal state values.</param>
        /// <param name="stateDisabled">Referenece to disabled state values.</param>
        /// <param name="stateTracking">Referenece to tracking state values.</param>
        /// <param name="statePressed">Referenece to pressed state values.</param>
        /// <param name="needPaint">Delegate used to request repainting.</param>
        public ViewDrawTrackBar(PaletteTrackBarStatesOverride stateNormal,
                                PaletteTrackBarStates stateDisabled,
                                PaletteTrackBarPositionStatesOverride stateTracking,
                                PaletteTrackBarPositionStatesOverride statePressed,
                                NeedPaintHandler needPaint)
            : base(stateNormal.Back)
        {
            // Default state
            StateNormal   = stateNormal;
            StateDisabled = stateDisabled;
            StateTracking = stateTracking;
            StatePressed  = statePressed;
            Padding       = Padding.Empty;
            _orientation  = Orientation.Horizontal;
            _value        = 0;
            _minimum      = 0;
            _maximum      = 10;
            _smallChange  = 1;
            _largeChange  = 5;
            _tickFreq     = 1;
            _tickStyle    = TickStyle.BottomRight;
            TrackBarSize  = PaletteTrackBarSize.Medium;
            VolumeControl = false;
            _needPaint    = needPaint;

            // Create drawing/layout elements
            TrackPosition        = new ViewDrawTP(this);
            _ticksTop            = new ViewDrawTrackTicks(this, true);
            _ticksBottom         = new ViewDrawTrackTicks(this, false);
            _ticksTop.Visible    = false;
            _ticksBottom.Visible = true;

            // Connect up layout structure
            _layoutTop = new ViewLayoutDocker
            {
                { _ticksTop, ViewDockStyle.Top },
                { TrackPosition, ViewDockStyle.Top },
                { _ticksBottom, ViewDockStyle.Top }
            };
            _layoutTop.Padding = Padding;
            Add(_layoutTop);
        }
        /*
         * GetBodyGraphicsPath
         */

        private static GraphicsPath GetBodyGraphicsPath(Rectangle bounds, TickStyle tickStyle)
        {
            GraphicsPath gp = new GraphicsPath();

            switch (tickStyle)
            {
            case TickStyle.TopLeft:
            {
                float rectHeight = bounds.Bottom - NuGenSmoothTrackBarRenderer.GetAsymmetricSliderHeight(bounds) + 3;
                Point topCenter  = NuGenControlPaint.RectTCCorner(bounds);
                topCenter.Offset(0, 3);

                gp.AddLine(bounds.Left, rectHeight, topCenter.X, topCenter.Y);
                gp.AddLine(topCenter.X, topCenter.Y, bounds.Right, rectHeight);
                gp.AddLine(bounds.Right, bounds.Bottom - 4, bounds.Left, bounds.Bottom - 4);

                break;
            }

            case TickStyle.BottomRight:
            {
                float rectHeight   = NuGenSmoothTrackBarRenderer.GetAsymmetricSliderHeight(bounds) - 3;
                Point bottomCenter = NuGenControlPaint.RectBCCorner(bounds);
                bottomCenter.Offset(0, -3);

                gp.AddLine(bounds.Left, bounds.Top + 4, bounds.Right, bounds.Top + 4);
                gp.AddLine(bounds.Right, rectHeight, bottomCenter.X, bottomCenter.Y);
                gp.AddLine(bottomCenter.X, bottomCenter.Y, bounds.Left, rectHeight);

                break;
            }

            default:
            {
                gp.AddRectangle(Rectangle.Inflate(bounds, 0, -3));
                break;
            }
            }

            gp.CloseFigure();
            return(gp);
        }
        /*
         * GetGraphicsPath
         */

        private static GraphicsPath GetGraphicsPath(Rectangle bounds, TickStyle tickStyle)
        {
            switch (tickStyle)
            {
            case TickStyle.TopLeft:
            {
                return(NuGenSmoothTrackBarRenderer.GetTopLeftGraphicsPath(bounds));
            }

            case TickStyle.BottomRight:
            {
                return(NuGenSmoothTrackBarRenderer.GetBottomRightGraphicsPath(bounds));
            }

            default:
            {
                return(NuGenControlPaint.GetRoundRectangleGraphicsPath(bounds, 2));
            }
            }
        }
        /*
         * DrawSmallTickLine
         */

        private void DrawSmallTickLine(
            Graphics g,
            Rectangle bounds,
            NuGenControlState state,
            float offset,
            TickStyle tickStyle
            )
        {
            Debug.Assert(g != null, "g != null");

            int y1 = bounds.Top;
            int y2 = bounds.Bottom - 1;

            if (tickStyle == TickStyle.TopLeft)
            {
                y1 = bounds.Top + 1;
                y2 = bounds.Bottom;
            }

            this.DrawTickLine(g, offset, y1, y2, state);
        }
 private static PlotModel CreateTickStyleModel(TickStyle tickStyle)
 {
     var model = new PlotModel("TickStyle: " + tickStyle);
     model.Axes.Add(new LinearAxis(AxisPosition.Bottom)
                        {
                            TickStyle = tickStyle,
                            MajorGridlineStyle = LineStyle.None,
                            MinorGridlineStyle = LineStyle.None,
                            MaximumPadding = 0,
                            MinimumPadding = 0
                        });
     model.Axes.Add(new LinearAxis(AxisPosition.Left)
                        {
                            TickStyle = tickStyle,
                            MajorGridlineStyle = LineStyle.None,
                            MinorGridlineStyle = LineStyle.None,
                            MaximumPadding = 0,
                            MinimumPadding = 0
                        });
     return model;
 }
        /*
         * DrawTickLines
         */

        private void DrawTickLines(
            Graphics g,
            Rectangle bounds,
            NuGenControlState state,
            TickStyle tickStyle,
            INuGenValueTracker valueTracker
            )
        {
            Debug.Assert(g != null, "g != null");
            Debug.Assert(valueTracker != null, "valueTracker != null");

            float step          = NuGenSmoothTrackBarRenderer.GetStep(bounds, valueTracker) * valueTracker.SmallChange;
            float currentOffset = bounds.Left;

            this.DrawLargeTickLine(g, bounds, state, currentOffset, tickStyle);

            while ((currentOffset += step) < bounds.Right)
            {
                this.DrawSmallTickLine(g, bounds, state, currentOffset, tickStyle);
            }

            this.DrawLargeTickLine(g, bounds, state, bounds.Right, tickStyle);
        }
Beispiel #21
0
        /// <summary>
        /// Gets the tick positions.
        /// </summary>
        /// <param name="axis">The axis.</param>
        /// <param name="tickStyle">The tick style.</param>
        /// <param name="tickSize">The tick size.</param>
        /// <param name="position">The position.</param>
        /// <param name="x0">The x 0.</param>
        /// <param name="x1">The x 1.</param>
        protected virtual void GetTickPositions(Axis axis, TickStyle tickStyle, double tickSize, AxisPosition position, out double x0, out double x1)
        {
            x0 = 0;
            x1 = 0;
            bool   isTopOrLeft = position == AxisPosition.Top || position == AxisPosition.Left;
            double sign        = isTopOrLeft ? -1 : 1;

            switch (tickStyle)
            {
            case TickStyle.Crossing:
                x0 = -tickSize * sign * 0.75;
                x1 = tickSize * sign * 0.75;
                break;

            case TickStyle.Inside:
                x0 = -tickSize * sign;
                break;

            case TickStyle.Outside:
                x1 = tickSize * sign;
                break;
            }
        }
Beispiel #22
0
        public TrackBar()
        {
            autoSize       = true;
            largeChange    = 5;
            maximum        = 10;
            smallChange    = 1;
            tickFrequency  = 1;
            tickStyle      = TickStyle.BottomRight;
            orientation    = Orientation.Horizontal;
            minBarSize     = 8;
            trackSize      = 25;
            barRect        = Rectangle.Empty;
            barDown        = false;
            trackDown      = false;
            mouseCoords    = new Point(0, 0);
            valuechanged   = false;
            timer          = new Timer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = 1;

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
            // set cursor
            this.Cursor = Cursors.Hand;
        }
		public TrackBar()
		{
			autoSize = true;
			largeChange = 5;
			maximum = 10;
			smallChange = 1;
			tickFrequency = 1;
			tickStyle = TickStyle.BottomRight;
			orientation = Orientation.Horizontal;
			minBarSize = 8;
			trackSize = 25;
			barRect = Rectangle.Empty;
			barDown = false;
			trackDown = false;
			mouseCoords = new Point(0, 0);
			valuechanged = false;
			timer = new Timer();
			timer.Tick += new EventHandler(timer_Tick);
			timer.Interval = 1;

			SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw |ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
			// set cursor
			this.Cursor = Cursors.Hand;
		}
Beispiel #24
0
        private void GetVerticalTickPositions(Axis axis, TickStyle glt, double ticksize,
                                              out double y0, out double y1)
        {
            y0 = 0;
            y1 = 0;
            bool   istop   = axis.Position == AxisPosition.Top;
            double topsign = istop ? -1 : 1;

            switch (glt)
            {
            case TickStyle.Crossing:
                y0 = -ticksize * topsign;
                y1 = ticksize * topsign;
                break;

            case TickStyle.Inside:
                y0 = -ticksize * topsign;
                break;

            case TickStyle.Outside:
                y1 = ticksize * topsign;
                break;
            }
        }
Beispiel #25
0
        private void GetHorizontalTickPositions(Axis axis, TickStyle glt, double ticksize, out double x0,
                                                out double x1)
        {
            x0 = 0;
            x1 = 0;
            bool   isLeft   = axis.Position == AxisPosition.Left;
            double leftSign = isLeft ? -1 : 1;

            switch (glt)
            {
            case TickStyle.Crossing:
                x0 = -ticksize * leftSign;
                x1 = ticksize * leftSign;
                break;

            case TickStyle.Inside:
                x0 = -ticksize * leftSign;
                break;

            case TickStyle.Outside:
                x1 = ticksize * leftSign;
                break;
            }
        }
	// Draw a track bar control.
	public virtual void DrawTrackBar(Graphics graphics, Rectangle clientRect,
					Rectangle barRect, Orientation orientation, bool enabled,
					int ticks, TickStyle style)
	{
		int x = 0;
		int lineheight = 4;
		int linewidth = 4;

		if(orientation == Orientation.Horizontal) 
		{ // Draw horizontal
			x = (clientRect.Width / ticks) + 1;

			if(style == TickStyle.BottomRight) 
			{
				for(int cnt = x; cnt <= clientRect.Width; cnt += x) 
				{
					// right tick
					DrawBorder3D(graphics,
						clientRect.Left + cnt,
						clientRect.Height / 2,
						linewidth,
						clientRect.Height / lineheight,
						SystemColors.ControlText, SystemColors.Control,
						Border3DStyle.Sunken, Border3DSide.All);
				}
			}
			else if(style == TickStyle.TopLeft) 
			{
				for(int cnt = x; cnt <= clientRect.Width; cnt += x) 
				{
					// left tick
					DrawBorder3D(graphics,
						clientRect.Left + cnt,
						clientRect.Top + clientRect.Height / lineheight,
						linewidth,
						clientRect.Height / lineheight,
						SystemColors.ControlText, SystemColors.Control,
						Border3DStyle.Sunken, Border3DSide.All);
				}
			}
			else if(style == TickStyle.Both) 
			{
				for(int cnt = x; cnt <= clientRect.Width; cnt += x) 
				{
					// left tick
					DrawBorder3D(graphics,
						clientRect.Left + cnt,
						clientRect.Height / 2 - lineheight,
						linewidth,
						lineheight * 2 + lineheight / 2,
						SystemColors.ControlText, SystemColors.Control,
						Border3DStyle.Sunken, Border3DSide.All);
				}
			}
		}
		else 
		{ // Draw vertical
			x = (clientRect.Height / ticks) + 1;

			if(style == TickStyle.BottomRight) 
			{
				for(int cnt = x; cnt < clientRect.Height; cnt += x) 
				{
					// right tick
					DrawBorder3D(graphics,
						clientRect.Width / 2,
						clientRect.Top + cnt,
						clientRect.Width / linewidth,
						lineheight,
						SystemColors.ControlText, SystemColors.Control,
						Border3DStyle.Sunken, Border3DSide.All);
				}
			}
			else if(style == TickStyle.TopLeft) 
			{
				for(int cnt = x; cnt < clientRect.Height; cnt += x) 
				{
					// left tick
					DrawBorder3D(graphics,
						clientRect.Left + clientRect.Width / linewidth,
						clientRect.Top + cnt,
						clientRect.Width / linewidth,
						lineheight,
						SystemColors.ControlText, SystemColors.Control,
						Border3DStyle.Sunken, Border3DSide.All);
				}
			}
			else if(style == TickStyle.Both) 
			{
				for(int cnt = x; cnt < clientRect.Height; cnt += x) 
				{
					// left tick
					DrawBorder3D(graphics,
						clientRect.Width / 2 - linewidth,
						clientRect.Top + cnt,
						linewidth * 2 + linewidth / 2,
						lineheight,
						SystemColors.ControlText, SystemColors.Control,
						Border3DStyle.Sunken, Border3DSide.All);
				}
			}
		}

		// draw end lines if we have a tickstyle
		if(style != TickStyle.None) 
		{
			if(orientation == Orientation.Horizontal) 
			{
				// Draw middle bar
				DrawBorder3D(graphics,
					clientRect.Left, (clientRect.Height / 2) - (lineheight / 2),
					clientRect.Width, lineheight,
					SystemColors.ControlText, SystemColors.Control,
					Border3DStyle.Sunken, Border3DSide.All);

				// left vertical bar
				DrawBorder3D(graphics,
					clientRect.Left, clientRect.Top,
					linewidth, clientRect.Height,
					SystemColors.ControlText, SystemColors.Control,
					Border3DStyle.Sunken, Border3DSide.All);

				// right vertical bar
				DrawBorder3D(graphics,
					clientRect.Right - linewidth, clientRect.Top,
					linewidth, clientRect.Height,
					SystemColors.ControlText, SystemColors.Control,
					Border3DStyle.Sunken, Border3DSide.All);
			}
			else 
			{
				// Draw middle bar
				DrawBorder3D(graphics,
					clientRect.Width / 2 - 1, clientRect.Y,
					linewidth, clientRect.Height,
					SystemColors.ControlText, SystemColors.Control,
					Border3DStyle.Sunken, Border3DSide.All);

				// top horizontal bar
				DrawBorder3D(graphics,
					clientRect.Left, clientRect.Top,
					clientRect.Width, lineheight,
					SystemColors.ControlText, SystemColors.Control,
					Border3DStyle.Sunken, Border3DSide.All);

				// bottom horizontal bar
				DrawBorder3D(graphics,
					clientRect.Left, clientRect.Bottom - lineheight,
					clientRect.Width, lineheight,
					SystemColors.ControlText, SystemColors.Control,
					Border3DStyle.Sunken, Border3DSide.All);
			}
		}

		// draw the button
		if (((barRect.Height > 0) ||
			(barRect.Width > 0)) && barRect.IntersectsWith(clientRect))
		{
			DrawButton(graphics,
				barRect.X, barRect.Y,
				barRect.Width,
				barRect.Height,
				(enabled ? ButtonState.Normal : ButtonState.Inactive),
				SystemColors.ControlText, SystemColors.Control,
				false);
		}
	}
 private void GetVerticalTickPositions(Axis axis, TickStyle glt, double ticksize,
                                       out double y0, out double y1)
 {
     y0 = 0;
     y1 = 0;
     bool istop = axis.Position == AxisPosition.Top;
     double topsign = istop ? -1 : 1;
     switch (glt)
     {
         case TickStyle.Crossing:
             y0 = -ticksize*topsign;
             y1 = ticksize*topsign;
             break;
         case TickStyle.Inside:
             y0 = -ticksize*topsign;
             break;
         case TickStyle.Outside:
             y1 = ticksize*topsign;
             break;
     }
 }
Beispiel #28
0
 /// <summary>
 /// Creates an example with the specified <see cref="TickStyle" />.
 /// </summary>
 /// <param name="tickStyle">The tick style.</param>
 /// <returns>A <see cref="PlotModel" />.</returns>
 private static PlotModel CreateTickStyleExample(TickStyle tickStyle)
 {
     var plotModel1 = new PlotModel { Title = "TickStyle = " + tickStyle };
     plotModel1.Axes.Add(new LinearAxis { Position = AxisPosition.Left, TickStyle = tickStyle });
     plotModel1.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, TickStyle = tickStyle });
     return plotModel1;
 }
		public TrackBar ()
		{
			orientation = Orientation.Horizontal;
			minimum = 0;
			maximum = 10;
			tickFrequency = 1;
			autosize = true;
			position = 0;
			tickStyle = TickStyle.BottomRight;
			smallChange = 1;
			largeChange = 5;			
			mouse_clickmove = false;			
			MouseDown += new MouseEventHandler (OnMouseDownTB); 
			MouseUp += new MouseEventHandler (OnMouseUpTB); 
			MouseMove += new MouseEventHandler (OnMouseMoveTB);
			MouseLeave += new EventHandler (OnMouseLeave);
			KeyDown += new KeyEventHandler (OnKeyDownTB);
			LostFocus += new EventHandler (OnLostFocusTB);
			GotFocus += new EventHandler (OnGotFocusTB);
			holdclick_timer.Elapsed += new ElapsedEventHandler (OnFirstClickTimer);

			SetStyle (ControlStyles.UserPaint | ControlStyles.Opaque
#if NET_2_0
				| ControlStyles.UseTextForAccessibility
#endif
				, false);
		}
 /// <summary>
 /// The get tick positions.
 /// </summary>
 /// <param name="axis">
 /// The axis.
 /// </param>
 /// <param name="glt">
 /// The glt.
 /// </param>
 /// <param name="ticksize">
 /// The ticksize.
 /// </param>
 /// <param name="position">
 /// The position.
 /// </param>
 /// <param name="x0">
 /// The x 0.
 /// </param>
 /// <param name="x1">
 /// The x 1.
 /// </param>
 protected void GetTickPositions(
     Axis axis, TickStyle glt, double ticksize, AxisPosition position, out double x0, out double x1)
 {
     x0 = 0;
     x1 = 0;
     bool isTopOrLeft = position == AxisPosition.Top || position == AxisPosition.Left;
     double sign = isTopOrLeft ? -1 : 1;
     switch (glt)
     {
         case TickStyle.Crossing:
             x0 = -ticksize * sign * 0.75;
             x1 = ticksize * sign * 0.75;
             break;
         case TickStyle.Inside:
             x0 = -ticksize * sign;
             break;
         case TickStyle.Outside:
             x1 = ticksize * sign;
             break;
     }
 }
    public void Init()
    {
        if (m_AddedCurves != null)
        {
            return;
        }

        m_AddedCurves = new List <CurveData>();

        // Colors
        m_Colors = new Color[]
        {
            new Color(255 / 255f, 158 / 255f, 33 / 255f),               // orange
            new Color(223 / 255f, 54 / 255f, 148 / 255f),               // purple
            new Color(0f, 175 / 255f, 255 / 255f),                      // blue
            new Color(255 / 255f, 235 / 255f, 0),                       // yellow
            new Color(50 / 255f, 255 / 255f, 68 / 255f),                // green
            new Color(250 / 255f, 0f, 0f),                              // red  (this is the first color used)
        };
        m_AvailableColors = new List <Color>(m_Colors);

        // Curve Editor
        m_CurveEditorSettings.useFocusColors                = true;
        m_CurveEditorSettings.showAxisLabels                = false;
        m_CurveEditorSettings.hRangeMin                     = 0.0f;
        m_CurveEditorSettings.vRangeMin                     = 0.0F;
        m_CurveEditorSettings.vRangeMax                     = 1.0f;
        m_CurveEditorSettings.hRangeMax                     = 1.0F;
        m_CurveEditorSettings.vSlider                       = false;
        m_CurveEditorSettings.hSlider                       = false;
        m_CurveEditorSettings.showWrapperPopups             = true;
        m_CurveEditorSettings.rectangleToolFlags            = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool;
        m_CurveEditorSettings.hTickLabelOffset              = 5;
        m_CurveEditorSettings.allowDraggingCurvesAndRegions = true;
        m_CurveEditorSettings.allowDeleteLastKeyInCurve     = false;

        TickStyle hTS = new TickStyle();

        hTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.2f);
        hTS.distLabel       = 30;
        hTS.stubs           = false;
        hTS.centerLabel     = true;
        m_CurveEditorSettings.hTickStyle = hTS;

        TickStyle vTS = new TickStyle();

        vTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.2f);
        vTS.distLabel       = 20;
        vTS.stubs           = false;
        vTS.centerLabel     = true;
        m_CurveEditorSettings.vTickStyle = vTS;

        m_CurveEditor             = new CurveEditor(new Rect(0, 0, 1000, 100), CreateCurveWrapperArray(), false);
        m_CurveEditor.settings    = m_CurveEditorSettings;
        m_CurveEditor.leftmargin  = 40;
        m_CurveEditor.rightmargin = m_CurveEditor.topmargin = m_CurveEditor.bottommargin = 25;
        m_CurveEditor.SetShownHRangeInsideMargins(m_CurveEditorSettings.hRangeMin, m_CurveEditorSettings.hRangeMax);
        m_CurveEditor.SetShownVRangeInsideMargins(m_CurveEditorSettings.vRangeMin, m_CurveEditorSettings.hRangeMax);
        m_CurveEditor.ignoreScrollWheelUntilClicked = false;

        Undo.undoRedoPerformed += UndoRedoPerformed;
    }
Beispiel #32
0
 //用图片画滑块
 private void DrawImgThunm(Graphics g, Rectangle _scrollRect, Orientation orientation, TickStyle TickStyle)
 {
     if (Bar != null)
     {
         Image myImage = (Image)Bar.Clone();
         //水平
         if (orientation == Orientation.Horizontal)
         {
             myImage.RotateFlip(TickStyle == TickStyle.TopLeft ? RotateFlipType.Rotate180FlipNone : RotateFlipType.RotateNoneFlipNone);
         }
         else    //垂直
         {
             myImage.RotateFlip(TickStyle == TickStyle.TopLeft ? RotateFlipType.Rotate90FlipNone : RotateFlipType.Rotate270FlipNone);
         }
         g.DrawImage(myImage, _scrollRect);
     }
 }
		/*
		 * GetGraphicsPath
		 */

		private static GraphicsPath GetGraphicsPath(Rectangle bounds, TickStyle tickStyle)
		{
			switch (tickStyle)
			{
				case TickStyle.TopLeft:
				{
					return NuGenSmoothTrackBarRenderer.GetTopLeftGraphicsPath(bounds);
				}
				case TickStyle.BottomRight:
				{
					return NuGenSmoothTrackBarRenderer.GetBottomRightGraphicsPath(bounds);
				}
				default:
				{
					return NuGenControlPaint.GetRoundRectangleGraphicsPath(bounds, 2);
				}
			}
		}
Beispiel #34
0
 public static string DecodeTickStyleInverse(TickStyle t)
 {
     return t.ToString();
 }
Beispiel #35
0
        /// <summary>
        /// Draw the track bar position glyph.
        /// </summary>
        /// <param name="context">Render context.</param>
        /// <param name="state">Element state.</param>
        /// <param name="elementPalette">Source of palette colors.</param>
        /// <param name="drawRect">Drawing rectangle that should contain the track.</param>
        /// <param name="orientation">Drawing orientation.</param>
        /// <param name="tickStyle">Tick marks that surround the position.</param>
        public override void DrawTrackPositionGlyph(RenderContext context,
                                                    PaletteState state,
                                                    IPaletteElementColor elementPalette,
                                                    Rectangle drawRect,
                                                    Orientation orientation,
                                                    TickStyle tickStyle)
        {
            GraphicsPath border = null;

            drawRect.Inflate(-1, -1);

            if (orientation == Orientation.Horizontal)
            {
                switch (tickStyle)
                {
                case TickStyle.None:
                case TickStyle.Both:
                    border = CreatePositionPathsBoth(drawRect);
                    break;

                case TickStyle.TopLeft:
                    border = CreatePositionPathsTop(drawRect);
                    break;

                case TickStyle.BottomRight:
                    border = CreatePositionPathsBottom(drawRect);
                    break;
                }
            }
            else
            {
                switch (tickStyle)
                {
                case TickStyle.None:
                case TickStyle.Both:
                    border = CreatePositionPathsBoth(drawRect);
                    break;

                case TickStyle.TopLeft:
                    border = CreatePositionPathsLeft(drawRect);
                    break;

                case TickStyle.BottomRight:
                    border = CreatePositionPathsRight(drawRect);
                    break;
                }
            }

            if (border != null)
            {
                using (AntiAlias aa = new AntiAlias(context.Graphics))
                {
                    using (SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor2(state)))
                        context.Graphics.FillPath(insideBrush, border);

                    using (Pen borderPen = new Pen(elementPalette.GetElementColor1(state)))
                        context.Graphics.DrawPath(borderPen, border);
                }

                border.Dispose();
            }
        }
Beispiel #36
0
 /// <summary>
 ///     Sets the tick style for the axis.
 /// </summary>
 /// <param name="axis">The axis to configure.</param>
 /// <param name="style">The style.</param>
 public static AxisConfigurator <T> SetTickStyle <T>(this AxisConfigurator <T> axis, TickStyle style)
     where T : Axis =>
 axis.Set(a => a.TickStyle, style);
        /// <summary>
        /// Initialize a new instance of the ViewDrawTrackBar class.
        /// </summary>
        /// <param name="stateNormal">Referenece to normal state values.</param>
        /// <param name="stateDisabled">Referenece to disabled state values.</param>
        /// <param name="stateTracking">Referenece to tracking state values.</param>
        /// <param name="statePressed">Referenece to pressed state values.</param>
        /// <param name="needPaint">Delegate used to request repainting.</param>
        public ViewDrawTrackBar(PaletteTrackBarStatesOverride stateNormal,
                                PaletteTrackBarStates stateDisabled,
                                PaletteTrackBarPositionStatesOverride stateTracking,
                                PaletteTrackBarPositionStatesOverride statePressed,
                                NeedPaintHandler needPaint)
            : base(stateNormal.Back)
        {
            // Default state
            _stateNormal = stateNormal;
            _stateDisabled = stateDisabled;
            _stateTracking = stateTracking;
            _statePressed = statePressed;
            _padding = Padding.Empty;
            _orientation = Orientation.Horizontal;
            _value = 0;
            _minimum = 0;
            _maximum = 10;
            _smallChange = 1;
            _largeChange = 5;
            _tickFreq = 1;
            _tickStyle = TickStyle.BottomRight;
            _trackBarSize = PaletteTrackBarSize.Medium;
            _volumeControl = false;
            _needPaint = needPaint;

            // Create drawing/layout elements
            _trackPosition = new ViewDrawTP(this);
            _ticksTop = new ViewDrawTrackTicks(this, true);
            _ticksBottom = new ViewDrawTrackTicks(this, false);
            _ticksTop.Visible = false;
            _ticksBottom.Visible = true;

            // Connect up layout structure
            _layoutTop = new ViewLayoutDocker();
            _layoutTop.Add(_ticksTop, ViewDockStyle.Top);
            _layoutTop.Add(_trackPosition, ViewDockStyle.Top);
            _layoutTop.Add(_ticksBottom, ViewDockStyle.Top);
            _layoutTop.Padding = Padding;
            Add(_layoutTop);
        }
	public void Init()
	{
		if (this.m_AddedCurves != null)
		{
			return;
		}
		this.m_AddedCurves = new List<ParticleSystemCurveEditor.CurveData>();
		this.m_Colors = new Color[]
		{
			new Color(1f, 0.619607866f, 0.129411772f),
			new Color(0.8745098f, 0.211764708f, 0.5803922f),
			new Color(0f, 0.6862745f, 1f),
			new Color(1f, 0.921568632f, 0f),
			new Color(0.196078435f, 1f, 0.266666681f),
			new Color(0.980392158f, 0f, 0f)
		};
		this.m_AvailableColors = new List<Color>(this.m_Colors);
		ParticleSystemCurveEditor.m_CurveEditorSettings.useFocusColors = true;
		ParticleSystemCurveEditor.m_CurveEditorSettings.showAxisLabels = false;
		ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin = 0f;
		ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin = 0f;
		ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMax = 1f;
		ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax = 1f;
		ParticleSystemCurveEditor.m_CurveEditorSettings.vSlider = false;
		ParticleSystemCurveEditor.m_CurveEditorSettings.hSlider = false;
		ParticleSystemCurveEditor.m_CurveEditorSettings.wrapColor = new Color(0f, 0f, 0f, 0f);
		ParticleSystemCurveEditor.m_CurveEditorSettings.hTickLabelOffset = 5f;
		ParticleSystemCurveEditor.m_CurveEditorSettings.allowDraggingCurvesAndRegions = true;
		ParticleSystemCurveEditor.m_CurveEditorSettings.allowDeleteLastKeyInCurve = false;
		TickStyle tickStyle = new TickStyle();
		tickStyle.color = new Color(0f, 0f, 0f, 0.2f);
		tickStyle.distLabel = 30;
		tickStyle.stubs = false;
		tickStyle.centerLabel = true;
		ParticleSystemCurveEditor.m_CurveEditorSettings.hTickStyle = tickStyle;
		TickStyle tickStyle2 = new TickStyle();
		tickStyle2.color = new Color(0f, 0f, 0f, 0.2f);
		tickStyle2.distLabel = 20;
		tickStyle2.stubs = false;
		tickStyle2.centerLabel = true;
		ParticleSystemCurveEditor.m_CurveEditorSettings.vTickStyle = tickStyle2;
		this.m_CurveEditor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), this.CreateCurveWrapperArray(), false);
		this.m_CurveEditor.settings = ParticleSystemCurveEditor.m_CurveEditorSettings;
		this.m_CurveEditor.leftmargin = 40f;
		ZoomableArea arg_2A2_0 = this.m_CurveEditor;
		float num = 25f;
		this.m_CurveEditor.bottommargin = num;
		num = num;
		this.m_CurveEditor.topmargin = num;
		arg_2A2_0.rightmargin = num;
		this.m_CurveEditor.SetShownHRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax);
		this.m_CurveEditor.SetShownVRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax);
		this.m_CurveEditor.ignoreScrollWheelUntilClicked = false;
		Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed));
	}
Beispiel #39
0
 //用图片画滑块
 private void DrawImgThunm(Graphics g, Rectangle _scrollRect, Orientation orientation, TickStyle TickStyle)
 {
     if (Bar != null)
     {
         Image myImage = (Image)Bar.Clone();
         //水平
         if (orientation == Orientation.Horizontal)
         {
             myImage.RotateFlip(TickStyle == TickStyle.TopLeft ? RotateFlipType.Rotate180FlipNone : RotateFlipType.RotateNoneFlipNone);
         }
         else    //垂直
         {
             myImage.RotateFlip(TickStyle == TickStyle.TopLeft ? RotateFlipType.Rotate90FlipNone : RotateFlipType.Rotate270FlipNone);
         }
         g.DrawImage(myImage, _scrollRect);
     }
 }
Beispiel #40
0
        private void DrawDefaultThunm(
            Graphics g, Rectangle thumbRect,
            Color begin, Color end, Color border, float mode,
            Orientation orientation, TickStyle tickStyle)
        {
            ThumbArrowDirection direction = ThumbArrowDirection.None;

            switch (orientation)
            {
            case Orientation.Horizontal:
                switch (tickStyle)
                {
                case TickStyle.None:
                case TickStyle.BottomRight:
                    direction = ThumbArrowDirection.Down;
                    break;

                case TickStyle.TopLeft:
                    direction = ThumbArrowDirection.Up;
                    break;

                case TickStyle.Both:
                    direction = ThumbArrowDirection.None;
                    break;
                }
                break;

            case Orientation.Vertical:
                switch (tickStyle)
                {
                case TickStyle.TopLeft:
                    direction = ThumbArrowDirection.Left;
                    break;

                case TickStyle.None:
                case TickStyle.BottomRight:
                    direction = ThumbArrowDirection.Right;
                    break;

                case TickStyle.Both:
                    direction = ThumbArrowDirection.None;
                    break;
                }
                break;
            }
            using (GraphicsPath path =
                       GraphicsPathHelper.CreateTrackBarThumbPath(
                           thumbRect, direction))
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(
                           thumbRect, begin, end, mode))
                {
                    Blend blend = new Blend();
                    blend.Positions = new float[] { 0, .2f, .5f, .8f, 1f };
                    blend.Factors   = new float[] { 1f, .7f, 0, .7f, 1f };
                    brush.Blend     = blend;

                    g.FillPath(brush, path);
                }
                using (Pen pen = new Pen(border))
                {
                    g.DrawPath(pen, path);
                }
            }

            thumbRect.Inflate(-1, -1);
            using (GraphicsPath path =
                       GraphicsPathHelper.CreateTrackBarThumbPath(
                           thumbRect, direction))
            {
                using (Pen pen = new Pen(InnerBorderColor))
                {
                    g.DrawPath(pen, path);
                }
            }
        }
Beispiel #41
0
        /// <summary>
        /// Draw the track bar position glyph.
        /// </summary>
        /// <param name="context">Render context.</param>
        /// <param name="state">Element state.</param>
        /// <param name="elementPalette">Source of palette colors.</param>
        /// <param name="drawRect">Drawing rectangle that should contain the track.</param>
        /// <param name="orientation">Drawing orientation.</param>
        /// <param name="tickStyle">Tick marks that surround the position.</param>
        public override void DrawTrackPositionGlyph(RenderContext context,
                                                    PaletteState state,
                                                    IPaletteElementColor elementPalette,
                                                    Rectangle drawRect,
                                                    Orientation orientation,
                                                    TickStyle tickStyle)
        {
            GraphicsPath outside = null;
            GraphicsPath border = null;
            GraphicsPath inside = null;

            if (orientation == Orientation.Horizontal)
            {
                switch (tickStyle)
                {
                    case TickStyle.None:
                    case TickStyle.Both:
                        CreatePositionPathsBoth(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.TopLeft:
                        CreatePositionPathsTop(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.BottomRight:
                        CreatePositionPathsBottom(drawRect, ref outside, ref border, ref inside);
                        break;
                }
            }
            else
            {
                switch (tickStyle)
                {
                    case TickStyle.None:
                    case TickStyle.Both:
                        CreatePositionPathsBoth(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.TopLeft:
                        CreatePositionPathsLeft(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.BottomRight:
                        CreatePositionPathsRight(drawRect, ref outside, ref border, ref inside);
                        break;
                }
            }

            if ((outside != null) && (border != null) && (inside != null))
            {
                using (AntiAlias aa = new AntiAlias(context.Graphics))
                {
                    using(Pen outsidePen = new Pen(elementPalette.GetElementColor1(state)),
                              borderPen = new Pen(elementPalette.GetElementColor2(state)))
                    {
                        context.Graphics.DrawPath(outsidePen, outside);

                        using(SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor3(state)))
                            context.Graphics.FillPath(insideBrush, border);

                        context.Graphics.DrawPath(borderPen, border);

                        using (LinearGradientBrush innerBrush = new LinearGradientBrush(inside.GetBounds(),
                                                                                        elementPalette.GetElementColor4(state),
                                                                                        elementPalette.GetElementColor5(state),
                                                                                        90f))
                        {
                            context.Graphics.FillPath(innerBrush, inside);
                        }
                    }
                }

                outside.Dispose();
                border.Dispose();
                inside.Dispose();
            }
        }
		/*
		 * GetBodyGraphicsPath
		 */

		private static GraphicsPath GetBodyGraphicsPath(Rectangle bounds, TickStyle tickStyle)
		{
			GraphicsPath gp = new GraphicsPath();

			switch (tickStyle)
			{
				case TickStyle.TopLeft:
				{
					float rectHeight = bounds.Bottom - NuGenSmoothTrackBarRenderer.GetAsymmetricSliderHeight(bounds) + 3;
					Point topCenter = NuGenControlPaint.RectTCCorner(bounds);
					topCenter.Offset(0, 3);

					gp.AddLine(bounds.Left, rectHeight, topCenter.X, topCenter.Y);
					gp.AddLine(topCenter.X, topCenter.Y, bounds.Right, rectHeight);
					gp.AddLine(bounds.Right, bounds.Bottom - 4, bounds.Left, bounds.Bottom - 4);

					break;
				}
				case TickStyle.BottomRight:
				{
					float rectHeight = NuGenSmoothTrackBarRenderer.GetAsymmetricSliderHeight(bounds) - 3;
					Point bottomCenter = NuGenControlPaint.RectBCCorner(bounds);
					bottomCenter.Offset(0, -3);

					gp.AddLine(bounds.Left, bounds.Top + 4, bounds.Right, bounds.Top + 4);
					gp.AddLine(bounds.Right, rectHeight, bottomCenter.X, bottomCenter.Y);
					gp.AddLine(bottomCenter.X, bottomCenter.Y, bounds.Left, rectHeight);

					break;
				}
				default:
				{
					gp.AddRectangle(Rectangle.Inflate(bounds, 0, -3));
					break;
				}
			}

			gp.CloseFigure();
			return gp;
		}
Beispiel #43
0
        private static PlotModel GetPlot(string name)
        {
            // RESOLUTION AND TICK SIZE
            int dpi = (int)(dpi_min + _random.NextDouble() * (dpi_max - dpi_min));

            int[] figsize = new[] { (int)(figsize_min + _random.NextDouble() * (figsize_max - figsize_min)), (int)(figsize_min + _random.NextDouble() * (figsize_max - figsize_min)) };

            List <double> tick_size = new List <double> {
                (tick_size_width_min + _random.NextDouble() * (tick_size_width_max - tick_size_width_min)), (tick_size_length_min + _random.NextDouble() * (tick_size_length_max - tick_size_length_min))
            };

            tick_size.Sort();

            // ACTUAL POINTS
            var points_nb     = (int)(points_nb_min + (Math.Pow(_random.NextDouble(), 1.5)) * (points_nb_max - points_nb_min));
            var x_scale       = (int)(x_min_top + _random.NextDouble() * (x_max_top - x_min_top));
            var y_scale       = (int)(y_min_top + _random.NextDouble() * (y_max_top - y_min_top));
            var x_scale_range = x_scale + (int)(_random.NextDouble() * x_scale_range_max);
            var y_scale_range = y_scale + (int)(_random.NextDouble() * y_scale_range_max);
            var x_min_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, x_scale);
            var x_max_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, x_scale_range);
            var x_min         = Math.Min(x_min_temp, x_max_temp);
            var x_max         = Math.Max(x_min_temp, x_max_temp);
            var y_min_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, y_scale);
            var y_max_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, y_scale_range);
            var y_min         = Math.Min(y_min_temp, y_max_temp);
            var y_max         = Math.Max(y_min_temp, y_max_temp);

            var xs = UniformContinuousDistribution.Random(x_min, x_max, points_nb, _random);

            double[] ys = new double[0];

            var distribution = Resources.point_dist[_random.Next(4)];

            if (distribution == "uniform")
            {
                ys = UniformContinuousDistribution.Random(y_min, y_max, points_nb, _random);
            }
            else if (distribution == "linear")
            {
                ys = xs.Multiply((Math.Max(y_max, -y_min) / (Math.Max(x_max, -x_min)))).Multiply((double)Resources.updown[_random.Next(2)])
                     .Add(UniformContinuousDistribution.Random(0, 1, points_nb, _random).Add(y_min).Multiply((y_max - y_min)).Multiply(_random.NextDouble() / 2.0));
            }
            else if (distribution == "quadratic")
            {
                ys = xs.Pow(2).Multiply(1.0 / (Math.Max(x_max, -x_min))).Pow(2).Multiply(Math.Max(y_max, -y_min)).Multiply((double)Resources.updown[_random.Next(2)])
                     .Add(UniformContinuousDistribution.Random(0, 1, points_nb, _random).Add(y_min).Multiply((y_max - y_min)).Multiply(_random.NextDouble() / 2.0));
            }
            else if (distribution == "binormal")
            {
                double stdDev = Math.Max(y_max, -y_min) / Math.Max(x_max, -x_min);
                double correl = (double)Resources.updown[_random.Next(2)] * _random.NextDouble();
                xs = NormalDistribution.Random(x_max - x_min, stdDev, points_nb, _random);
                ys = correl.Multiply(xs).Add(NormalDistribution.Random(y_max - y_min, stdDev, points_nb, _random).Multiply(Math.Sqrt(1 - correl * correl)));
            }

            // POINTS VARIATION
            var nb_points_var         = 1 + (int)(_random.NextDouble() * max_points_variations);
            var nb_points_var_colors  = 1 + (int)(_random.NextDouble() * nb_points_var);
            var nb_points_var_markers = 1 + (int)(_random.NextDouble() * (nb_points_var - nb_points_var_colors));
            var nb_points_var_size    = Math.Max(1, 1 + nb_points_var - nb_points_var_colors - nb_points_var_markers);

            var rand_color_number = _random.NextDouble();

            OxyColor[] colors = new OxyColor[nb_points_var_colors];
            OxyColor[] tempPalette;
            if (rand_color_number <= 0.5)
            {
                tempPalette = OxyPalettes.Rainbow(nb_points_var_colors * 20).Colors.ToArray();
            }
            else if (rand_color_number > 0.5 && rand_color_number <= 0.7)
            {
                tempPalette = OxyPalettes.Hue(nb_points_var_colors * 20).Colors.ToArray(); // gnuplot
            }
            else if (rand_color_number > 0.7 && rand_color_number <= 0.8)
            {
                tempPalette = OxyPalettes.Hot(nb_points_var_colors * 20).Colors.ToArray(); // copper
            }
            else
            {
                tempPalette = OxyPalettes.Jet(nb_points_var_colors * 20).Colors.ToArray(); // gray
            }

            for (int i = 0; i < nb_points_var_colors; i++)
            {
                colors[i] = tempPalette[_random.Next(nb_points_var_colors * 20)];
            }

            var s_set          = (size_points_min.Add(UniformContinuousDistribution.Random(0, 1, nb_points_var_size, _random).Multiply(size_points_max - size_points_min)));
            var markers_subset = new List <MarkerType>();

            for (int i = 0; i < nb_points_var_markers; i++)
            {
                markers_subset.Add(Resources.Markers[_random.Next(Resources._markersCount)]);
            }

            var markers_empty       = _random.NextDouble() > 0.75;
            var markers_empty_ratio = new[] { 0.0, 0.5, 0.7 }[_random.Next(3)];



            // PAD BETWEEN TICKS AND LABELS
            double    pad_x             = Math.Max(tick_size[1] + 0.5, (int)(pad_min + _random.NextDouble() * (pad_max - pad_min)));
            double    pad_y             = Math.Max(tick_size[1] + 0.5, (int)(pad_min + _random.NextDouble() * (pad_max - pad_min)));
            TickStyle direction_ticks_x = Resources.DirectionTicks[_random.Next(Resources._directionTicksCount)];
            TickStyle direction_ticks_y = Resources.DirectionTicks[_random.Next(Resources._directionTicksCount)];

            // FONT AND SIZE FOR LABELS (tick labels, axes labels and title)
            string font       = Resources.FontList[_random.Next(Resources._fontListCount)];
            int    size_ticks = (int)(tick_label_size_min + _random.NextDouble() * (tick_label_size_max - tick_label_size_min));
            int    size_axes  = (int)(axes_label_size_min + _random.NextDouble() * (axes_label_size_max - axes_label_size_min));
            int    size_title = (int)(title_size_min + _random.NextDouble() * (title_size_max - title_size_min));
            //var ticks_font = font_manager.FontProperties(fname = font, style = 'normal', size = size_ticks, weight = 'normal', stretch = 'normal');
            //var axes_font = font_manager.FontProperties(fname = font, style = 'normal', size = size_axes, weight = 'normal', stretch = 'normal');
            //var title_font = font_manager.FontProperties(fname = font, style = 'normal', size = size_title, weight = 'normal', stretch = 'normal');

            // TEXTS FOR AXIS LABELS AND TITLE
            int    label_x_length = (int)(axes_label_length_min + _random.NextDouble() * (axes_label_length_max - axes_label_length_min));
            int    label_y_length = (int)(axes_label_length_min + _random.NextDouble() * (axes_label_length_max - axes_label_length_min));
            int    title_length   = (int)(title_length_min + _random.NextDouble() * (title_length_max - title_length_min));
            string x_label        = RandomString(label_x_length);
            string y_label        = RandomString(label_y_length);
            string title          = RandomString(title_length);

            // BUILDING THE PLOT
            PlotModel model = new PlotModel
            {
                Title                   = title,
                TitleFont               = font,
                TitleFontSize           = size_title,
                DefaultColors           = colors,
                PlotAreaBorderThickness = new OxyThickness(0)
            };

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.None, Palette = new OxyPalette(colors), Minimum = 0, Maximum = colors.Length - 1
            });

            // TICKS STYLE AND LOCATION (X AXIS)
            LineStyle lineStyle = Resources.LineStyles[_random.Next(Resources._lineStylesCount)];
            var       xAxis     = new LinearAxis
            {
                Position           = _random.NextDouble() > 0.5 ? AxisPosition.Top : AxisPosition.Bottom,
                TickStyle          = direction_ticks_x,
                MajorGridlineStyle = lineStyle,
                MajorTickSize      = tick_size[1],
                MinorTickSize      = (_random.NextDouble() > 77) ? 0.75 * _random.NextDouble() * tick_size[1] : 0,
                Angle                  = _random.NextDouble() > 0.77 ? _random.NextDouble() * (double)Resources.updown[_random.Next(2)] * 90 : 0,
                Font                   = font,
                FontSize               = size_ticks,
                TitleFont              = font,
                TitleFontSize          = size_axes,
                Title                  = _random.NextDouble() > 0.80 ? "" : x_label,
                PositionAtZeroCrossing = (_random.NextDouble() > 0.77),
                IsAxisVisible          = true,
                AxislineColor          = OxyColors.Black,
                AxislineStyle          = LineStyle.Solid
            };

            model.Axes.Add(xAxis);

            // TICKS STYLE AND LOCATION (Y AXIS)
            var yAxis = new LinearAxis
            {
                Position           = _random.NextDouble() > 0.5 ? AxisPosition.Right : AxisPosition.Left,
                TickStyle          = direction_ticks_y,
                MajorGridlineStyle = lineStyle,
                MajorTickSize      = tick_size[1],
                MinorTickSize      = (_random.NextDouble() > 77) ? 0.75 * _random.NextDouble() * tick_size[1] : 0,
                Angle                  = _random.NextDouble() > 0.77 ? _random.NextDouble() * 90 : 0,
                Font                   = font,
                FontSize               = size_ticks,
                TitleFont              = font,
                TitleFontSize          = size_axes,
                Title                  = _random.NextDouble() > 0.80 ? "" : y_label,
                PositionAtZeroCrossing = (_random.NextDouble() > 0.77),
                IsAxisVisible          = true,
                AxislineColor          = OxyColors.Black,
                AxislineStyle          = LineStyle.Solid
            };

            model.Axes.Add(yAxis);

            MarkerType markerType = Resources.Markers[_random.Next(Resources._markersCount)];

            var scatterSerie = new ScatterSeries()
            {
                MarkerType            = markerType,
                MarkerStrokeThickness = _random.Next(10, 31) / 10,
            };

            if (markerType != MarkerType.Cross && markerType != MarkerType.Plus && markerType != MarkerType.Star)
            {
                if (_random.NextDouble() > 0.5)
                {
                    scatterSerie.MarkerStroke = OxyColors.Black;
                }
            }

            List <double> s = new List <double>();

            for (int i = 0; i < points_nb; i++)
            {
                var s_ = s_set[_random.Next(s_set.Length)];
                var c_ = colors[_random.Next(colors.Length)];
                var m_ = Resources.Markers[_random.Next(Resources._markersCount)];

                bool e_ = false;

                if (markers_empty)
                {
                    e_ = _random.NextDouble() > markers_empty_ratio;
                }

                scatterSerie.Points.Add(new ScatterPoint(xs[i], ys[i], s_, _random.Next(colors.Length)));
            }

            model.Series.Add(scatterSerie);
            return(model);
        }
		/*
		 * GetTickLinesBounds
		 */

		private static Rectangle GetTickLinesBounds(Rectangle trackBounds, TickStyle tickStyle)
		{
			Rectangle rect = Rectangle.Empty;
			int tickLinesHeight = trackBounds.Height * 3;

			if (tickStyle == TickStyle.BottomRight)
			{
				rect = new Rectangle(
					trackBounds.Left,
					trackBounds.Bottom + tickLinesHeight,
					trackBounds.Width,
					trackBounds.Height
				);
			}
			else if (tickStyle == TickStyle.TopLeft)
			{
				rect = new Rectangle(
					trackBounds.Left,
					trackBounds.Top - trackBounds.Height - tickLinesHeight,
					trackBounds.Width,
					trackBounds.Height
				);
			}

			return rect;
		}
Beispiel #45
0
        private void DrawDefaultThunm(
            Graphics g, Rectangle thumbRect,
            Color begin, Color end, Color border, float mode,
            Orientation orientation, TickStyle tickStyle)
        {
            ThumbArrowDirection direction = ThumbArrowDirection.None;

            switch (orientation)
            {
                case Orientation.Horizontal:
                    switch (tickStyle)
                    {
                        case TickStyle.None:
                        case TickStyle.BottomRight:
                            direction = ThumbArrowDirection.Down;
                            break;
                        case TickStyle.TopLeft:
                            direction = ThumbArrowDirection.Up;
                            break;
                        case TickStyle.Both:
                            direction = ThumbArrowDirection.None;
                            break;
                    }
                    break;
                case Orientation.Vertical:
                    switch (tickStyle)
                    {
                        case TickStyle.TopLeft:
                            direction = ThumbArrowDirection.Left;
                            break;
                        case TickStyle.None:
                        case TickStyle.BottomRight:
                            direction = ThumbArrowDirection.Right;
                            break;
                        case TickStyle.Both:
                            direction = ThumbArrowDirection.None;
                            break;
                    }
                    break;
            }
            using (GraphicsPath path =
                GraphicsPathHelper.CreateTrackBarThumbPath(
                thumbRect, direction))
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(
                    thumbRect, begin, end, mode))
                {
                    Blend blend = new Blend();
                    blend.Positions = new float[] { 0, .2f, .5f, .8f, 1f };
                    blend.Factors = new float[] { 1f, .7f, 0, .7f, 1f };
                    brush.Blend = blend;

                    g.FillPath(brush, path);
                }
                using (Pen pen = new Pen(border))
                {
                    g.DrawPath(pen, path);
                }
            }

            thumbRect.Inflate(-1, -1);
            using (GraphicsPath path =
               GraphicsPathHelper.CreateTrackBarThumbPath(
               thumbRect, direction))
            {
                using (Pen pen = new Pen(InnerBorderColor))
                {
                    g.DrawPath(pen, path);
                }
            }
        }
		/*
		 * DrawTickLines
		 */

		private void DrawTickLines(
			Graphics g,
			Rectangle bounds,
			NuGenControlState state,
			TickStyle tickStyle,
			INuGenValueTracker valueTracker
			)
		{
			Debug.Assert(g != null, "g != null");
			Debug.Assert(valueTracker != null, "valueTracker != null");

			float step = NuGenSmoothTrackBarRenderer.GetStep(bounds, valueTracker) * valueTracker.SmallChange;
			float currentOffset = bounds.Left;

			this.DrawLargeTickLine(g, bounds, state, currentOffset, tickStyle);

			while ((currentOffset += step) < bounds.Right)
			{
				this.DrawSmallTickLine(g, bounds, state, currentOffset, tickStyle);
			}

			this.DrawLargeTickLine(g, bounds, state, bounds.Right, tickStyle);
		}
 public void Init()
 {
     if (this.m_AddedCurves == null)
     {
         this.m_AddedCurves = new List<CurveData>();
         this.m_Colors = new Color[] { new Color(1f, 0.6196079f, 0.1294118f), new Color(0.8745098f, 0.2117647f, 0.5803922f), new Color(0f, 0.6862745f, 1f), new Color(1f, 0.9215686f, 0f), new Color(0.1960784f, 1f, 0.2666667f), new Color(0.9803922f, 0f, 0f) };
         this.m_AvailableColors = new List<Color>(this.m_Colors);
         m_CurveEditorSettings.useFocusColors = true;
         m_CurveEditorSettings.showAxisLabels = false;
         m_CurveEditorSettings.hRangeMin = 0f;
         m_CurveEditorSettings.vRangeMin = 0f;
         m_CurveEditorSettings.vRangeMax = 1f;
         m_CurveEditorSettings.hRangeMax = 1f;
         m_CurveEditorSettings.vSlider = false;
         m_CurveEditorSettings.hSlider = false;
         m_CurveEditorSettings.showWrapperPopups = true;
         m_CurveEditorSettings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool;
         m_CurveEditorSettings.hTickLabelOffset = 5f;
         m_CurveEditorSettings.allowDraggingCurvesAndRegions = true;
         m_CurveEditorSettings.allowDeleteLastKeyInCurve = false;
         TickStyle style = new TickStyle {
             tickColor = { color = new Color(0f, 0f, 0f, 0.2f) },
             distLabel = 30,
             stubs = false,
             centerLabel = true
         };
         m_CurveEditorSettings.hTickStyle = style;
         TickStyle style2 = new TickStyle {
             tickColor = { color = new Color(0f, 0f, 0f, 0.2f) },
             distLabel = 20,
             stubs = false,
             centerLabel = true
         };
         m_CurveEditorSettings.vTickStyle = style2;
         this.m_CurveEditor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), this.CreateCurveWrapperArray(), false);
         this.m_CurveEditor.settings = m_CurveEditorSettings;
         this.m_CurveEditor.leftmargin = 40f;
         float num = 25f;
         this.m_CurveEditor.bottommargin = num;
         this.m_CurveEditor.topmargin = num;
         this.m_CurveEditor.rightmargin = num;
         this.m_CurveEditor.SetShownHRangeInsideMargins(m_CurveEditorSettings.hRangeMin, m_CurveEditorSettings.hRangeMax);
         this.m_CurveEditor.SetShownVRangeInsideMargins(m_CurveEditorSettings.vRangeMin, m_CurveEditorSettings.hRangeMax);
         this.m_CurveEditor.ignoreScrollWheelUntilClicked = false;
         Undo.undoRedoPerformed = (Undo.UndoRedoCallback) Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed));
     }
 }
		/*
		 * DrawSmallTickLine
		 */

		private void DrawSmallTickLine(
			Graphics g,
			Rectangle bounds,
			NuGenControlState state,
			float offset,
			TickStyle tickStyle
			)
		{
			Debug.Assert(g != null, "g != null");

			int y1 = bounds.Top;
			int y2 = bounds.Bottom - 1;

			if (tickStyle == TickStyle.TopLeft)
			{
				y1 = bounds.Top + 1;
				y2 = bounds.Bottom;
			}

			this.DrawTickLine(g, offset, y1, y2, state);
		}
Beispiel #49
0
 /// <summary>
 /// Draw the track bar position glyph.
 /// </summary>
 /// <param name="context">Render context.</param>
 /// <param name="state">Element state.</param>
 /// <param name="elementPalette">Source of palette colors.</param>
 /// <param name="drawRect">Drawing rectangle that should contain the track.</param>
 /// <param name="orientation">Drawing orientation.</param>
 /// <param name="tickStyle">Tick marks that surround the position.</param>
 public abstract void DrawTrackPositionGlyph(RenderContext context,
                                             PaletteState state,
                                             IPaletteElementColor elementPalette,
                                             Rectangle drawRect,
                                             Orientation orientation,
                                             TickStyle tickStyle);
 private void GetHorizontalTickPositions(Axis axis, TickStyle glt, double ticksize, out double x0,
                                         out double x1)
 {
     x0 = 0;
     x1 = 0;
     bool isLeft = axis.Position == AxisPosition.Left;
     double leftSign = isLeft ? -1 : 1;
     switch (glt)
     {
         case TickStyle.Crossing:
             x0 = -ticksize*leftSign;
             x1 = ticksize*leftSign;
             break;
         case TickStyle.Inside:
             x0 = -ticksize*leftSign;
             break;
         case TickStyle.Outside:
             x1 = ticksize*leftSign;
             break;
     }
 }