Example #1
0
        public override void Rewind(uint idx)
        {
            m_idx = idx;

            switch (idx)
            {
            default:

            case 0:                                     // Background
                m_vertex = 0;
                m_vx[0]  = m_Bounds.Left - m_border_extra;
                m_vy[0]  = m_Bounds.Bottom - m_border_extra;
                m_vx[1]  = m_Bounds.Right + m_border_extra;
                m_vy[1]  = m_Bounds.Bottom - m_border_extra;
                m_vx[2]  = m_Bounds.Right + m_border_extra;
                m_vy[2]  = m_Bounds.Top + m_border_extra;
                m_vx[3]  = m_Bounds.Left - m_border_extra;
                m_vy[3]  = m_Bounds.Top + m_border_extra;
                break;

            case 1:                                     // Triangle
                m_vertex = 0;
                if (m_descending)
                {
                    m_vx[0] = m_Bounds.Left;
                    m_vy[0] = m_Bounds.Bottom;
                    m_vx[1] = m_Bounds.Right;
                    m_vy[1] = m_Bounds.Bottom;
                    m_vx[2] = m_Bounds.Left;
                    m_vy[2] = m_Bounds.Top;
                    m_vx[3] = m_Bounds.Left;
                    m_vy[3] = m_Bounds.Bottom;
                }
                else
                {
                    m_vx[0] = m_Bounds.Left;
                    m_vy[0] = m_Bounds.Bottom;
                    m_vx[1] = m_Bounds.Right;
                    m_vy[1] = m_Bounds.Bottom;
                    m_vx[2] = m_Bounds.Right;
                    m_vy[2] = m_Bounds.Top;
                    m_vx[3] = m_Bounds.Left;
                    m_vy[3] = m_Bounds.Bottom;
                }
                break;

            case 2:
                m_text.Text = m_label;
                if (m_label.Length > 0)
                {
                    string buf;
                    buf         = string.Format(m_label, Value());
                    m_text.Text = buf;
                }
                m_text.StartPoint(m_Bounds.Left, m_Bounds.Bottom);
                m_text.SetFontSize((m_Bounds.Top - m_Bounds.Bottom) * 1.2);
                m_text_poly.Width(m_text_thickness);
                m_text_poly.LineJoin(MathStroke.ELineJoin.round_join);
                m_text_poly.LineCap(MathStroke.ELineCap.round_cap);
                m_text_poly.Rewind(0);
                break;

            case 3:                                     // pointer preview
                m_ellipse.Init(m_xs1 + (m_xs2 - m_xs1) * m_preview_value,
                               (m_ys1 + m_ys2) / 2.0,
                               m_Bounds.Top - m_Bounds.Bottom,
                               m_Bounds.Top - m_Bounds.Bottom,
                               32);
                break;

            case 4:                                     // pointer
                NormalizeValue(false);
                m_ellipse.Init(m_xs1 + (m_xs2 - m_xs1) * m_value,
                               (m_ys1 + m_ys2) / 2.0,
                               m_Bounds.Top - m_Bounds.Bottom,
                               m_Bounds.Top - m_Bounds.Bottom,
                               32);
                m_ellipse.Rewind(0);
                break;

            case 5:
                m_storage.RemoveAll();
                if (m_num_steps != 0)
                {
                    uint   i;
                    double d = (m_xs2 - m_xs1) / m_num_steps;
                    if (d > 0.004)
                    {
                        d = 0.004;
                    }
                    for (i = 0; i < m_num_steps + 1; i++)
                    {
                        double x = m_xs1 + (m_xs2 - m_xs1) * i / m_num_steps;
                        m_storage.move_to(x, m_Bounds.Bottom);
                        m_storage.line_to(x - d * (m_Bounds.Right - m_Bounds.Left), m_Bounds.Bottom - m_border_extra);
                        m_storage.line_to(x + d * (m_Bounds.Right - m_Bounds.Left), m_Bounds.Bottom - m_border_extra);
                    }
                }
                break;
            }
        }