Exemple #1
0
        /// <summary>
        /// Labelses the position changed.
        /// </summary>
        /// <param name="d">The d.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        void LabelsPositionChanged(object d, SelectionChangedEventArgs e)
        {
            if (m_scale != null)
            {
                int count = m_scale.Ticks.Count;
                for (int i = 0; i < count; i++)
                {
                    if (m_scale.Ticks[i] is CircularLabelTick)
                    {
                        CircularLabelTick tick = m_scale.Ticks[i] as CircularLabelTick;
                        switch (this.LabelsPositionComboBox.SelectedIndex)
                        {
                        // Set TickPlacement as Inside
                        case 0:
                            tick.TickPlacement = ScalePlacement.Inside;
                            break;

                        // Set TickPlacement as Cross
                        case 1:
                            tick.TickPlacement = ScalePlacement.Cross;
                            break;

                        // Set TickPlacement as Outside
                        case 2:
                            tick.TickPlacement = ScalePlacement.Outside;
                            break;
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes the log.
        /// </summary>
        public void InitializeLog()
        {
            m_scale = new CircularScale();
            m_scale.ShadowOffset       = 1;
            m_scale.Minimum            = 0;
            m_scale.Maximum            = 100;
            m_scale.MinorIntervalValue = 5;
            m_scale.MajorIntervalValue = 20;
            m_scale.StartAngle         = 120;
            m_scale.GapSweepAngle      = 300;
            m_scale.ScaleBarSize       = 7;
            m_scale.Radius             = 60;
            m_scale.BorderWidth        = 1.0;


            m_scale1 = new CircularScale();
            m_scale1.ShadowOffset       = 1;
            m_scale1.Minimum            = 0;
            m_scale1.Maximum            = 100;
            m_scale1.MinorIntervalValue = 5;
            m_scale1.MajorIntervalValue = 10;
            m_scale1.StartAngle         = 120;
            m_scale1.GapSweepAngle      = 300;
            m_scale1.ScaleBarSize       = 0.5;
            m_scale1.Radius             = 40;
            m_scale1.BorderWidth        = 1.2;


            this.circularGauge1.Scales.Add(m_scale);
            this.circularGauge1.Scales.Add(m_scale1);


            CircularLabelTick majorLabelTick = new CircularLabelTick();

            majorLabelTick.FontSize          = 13;
            majorLabelTick.TickStyle         = TickStyle.MajorTick;
            majorLabelTick.TickPlacement     = ScalePlacement.Inside;
            majorLabelTick.DistanceFromScale = 5;

            CircularMarkTick majorTick = new CircularMarkTick();

            majorTick.TickWidth  = 5;
            majorTick.TickHeight = 10;
            majorTick.TickStyle  = TickStyle.MajorTick;
            majorTick.TickShape  = TickShape.RoundedRectangle;


            CircularMarkTick minorTick = new CircularMarkTick();

            minorTick.TickWidth  = 1;
            minorTick.TickHeight = 4;
            minorTick.TickStyle  = TickStyle.MinorTick;

            CircularLabelTick majorLabelTick1 = new CircularLabelTick();

            majorLabelTick1.FontSize  = 11;
            majorLabelTick1.TickStyle = TickStyle.MajorTick;


            majorLabelTick1.TickPlacement     = ScalePlacement.Inside;
            majorLabelTick1.DistanceFromScale = 5;

            CircularMarkTick majorTick1 = new CircularMarkTick();

            majorTick1.TickWidth  = 4;
            majorTick1.TickHeight = 9;
            majorTick1.TickStyle  = TickStyle.MajorTick;
            majorTick1.TickShape  = TickShape.Ellipse;

            CircularMarkTick minorTick1 = new CircularMarkTick();

            minorTick1.TickWidth  = 1;
            minorTick1.TickHeight = 4;
            minorTick1.TickStyle  = TickStyle.MinorTick;


            m_scale.Ticks.Add(minorTick);
            m_scale.Ticks.Add(majorTick);
            m_scale.Ticks.Add(majorLabelTick);

            m_scale1.Ticks.Add(minorTick1);
            m_scale1.Ticks.Add(majorTick1);
            m_scale1.Ticks.Add(majorLabelTick1);


            m_scale.PointerCap.PointerCapRadius  = 7;
            m_scale1.PointerCap.PointerCapRadius = 7;


            CircularPointer pointer1 = new CircularPointer();

            pointer1.BorderWidth      = 0.3;
            pointer1.PointerLength    = 40;
            pointer1.PointerWidth     = 10;
            pointer1.PointerPlacement = ScalePlacement.Outside;


            CircularPointer pointer3 = new CircularPointer();

            pointer3.BorderWidth      = 0.3;
            pointer3.PointerLength    = 70;
            pointer3.PointerWidth     = 10;
            pointer3.Value            = 50;
            pointer3.PointerPlacement = ScalePlacement.Outside;


            m_scale.Pointers.Add(pointer1);
            m_scale1.Pointers.Add(pointer3);

            // Subscribe GapSweepAngle property changed event
            m_scale.GapSweepAngleChanged += new PropertyChangedCallback(m_scale_GapSweepAngleChanged);
            // Subscribe GapSweepAngle property changed event
            m_scale1.GapSweepAngleChanged += new PropertyChangedCallback(m_scale1_GapSweepAngleChanged);
            // Subscribe Location property changed event
            m_scale.LocationChanged += new PropertyChangedCallback(m_scale_LocationChanged);
            // Subscribe Location property changed event
            m_scale1.LocationChanged += new PropertyChangedCallback(m_scale1_LocationChanged);
            // Subscribe Maximum property changed event
            m_scale.MaximumChanged += new PropertyChangedCallback(m_scale_MaximumChanged);
            // Subscribe Maximum property changed event
            m_scale1.MaximumChanged += new PropertyChangedCallback(m_scale1_MaximumChanged);
            // Subscribe Minimum property changed event
            m_scale1.MinimumChanged += new PropertyChangedCallback(m_scale1_MinimumChanged);
            // Subscribe Minimum property changed event
            m_scale.MinimumChanged += new PropertyChangedCallback(m_scale_MinimumChanged);
            // Subscribe MajorIntervalValue property changed event
            m_scale.MajorIntervalValueChanged += new PropertyChangedCallback(m_scale_MajorIntervalValueChanged);
            // Subscribe MinorIntervalValue property changed event
            m_scale.MinorIntervalValueChanged += new PropertyChangedCallback(m_scale1_MinorIntervalValueChanged);
            // Subscribe StartAngle property changed event
            m_scale.StartAngleChanged += new PropertyChangedCallback(m_scale_StartAngleChanged);
            // Subscribe StartAngle property changed event
            m_scale1.StartAngleChanged += new PropertyChangedCallback(m_scale1_StartAngleChanged);
            // Subscribe Radius property changed event
            m_scale.RadiusChanged += new PropertyChangedCallback(m_scale_RadiusChanged);
            // Subscribe Radius property changed event
            m_scale1.RadiusChanged += new PropertyChangedCallback(m_scale1_RadiusChanged);
            // Subscribe BorderWidth property changed event
            //m_scale.BorderWidthChanged += new PropertyChangedCallback(m_scale_BorderWidthChanged);
            // Subscribe BorderWidth property changed event
            //m_scale1.BorderWidthChanged += new PropertyChangedCallback(m_scale1_BorderWidthChanged);
            // Subscribe ScaleBarSize property changed event
            m_scale.ScaleBarSizeChanged += new PropertyChangedCallback(m_scale_ScaleBarSizeChanged);
            // Subscribe ScaleBarSize property changed event
            m_scale1.ScaleBarSizeChanged += new PropertyChangedCallback(m_scale1_ScaleBarSizeChanged);
            // Subscribe Value property changed event
            (m_scale.Pointers[0] as CircularPointer).ValueChanged += new PropertyChangedCallback(Changed);

            ScaleRadiusSlider.Value  = 90;
            ScaleRadiusSlider1.Value = 60;
        }