예제 #1
0
        /**绘画刻度值
         * **/
        public DockPanel DrawScaleLable(ScaleStyle tStyle, String labletxt)
        {
            DockPanel LablePanel = new DockPanel();

            LablePanel.Height                = tStyle.TickHeight;
            LablePanel.Width                 = tStyle.TickWidth / 3;
            LablePanel.LastChildFill         = false;
            LablePanel.HorizontalAlignment   = HorizontalAlignment.Center;
            LablePanel.VerticalAlignment     = VerticalAlignment.Stretch;
            LablePanel.RenderTransformOrigin = new Point(0.5, 0.5);
            LablePanel.RenderTransform       = new RotateTransform(tStyle.TickAngle - 90);
            Panel.SetZIndex(LablePanel, 2);

            TextBlock LableScale = new TextBlock();

            LableScale.Width = 100;
            LableScale.HorizontalAlignment = HorizontalAlignment.Center;
            LableScale.VerticalAlignment   = VerticalAlignment.Top;
            LableScale.TextAlignment       = TextAlignment.Center;
            LableScale.Margin = new Thickness(0, tStyle.SLabelMargin, 0, 0);
            LableScale.Text   = labletxt;
            LableScale.Style  = TickLabelStyle;
            LablePanel.Children.Add(LableScale);

            return(LablePanel);
        }
예제 #2
0
        /**绘画刻度
         * **/
        public DockPanel DrawScale(ScaleStyle tStyle)
        {
            DockPanel ScalePanel = new DockPanel();

            ScalePanel.Width = tStyle.TickWidth;
            ScalePanel.RenderTransformOrigin = new Point(0.5, 0.5);
            ScalePanel.RenderTransform       = new RotateTransform(tStyle.TickAngle);

            Panel.SetZIndex(ScalePanel, 2);
            ScalePanel.LastChildFill = false;

            ScalePanel.VerticalAlignment = VerticalAlignment.Center;
            Line ScaleLine = new Line();

            ScaleLine.X1              = 100;
            ScaleLine.Width           = tStyle.LineHeight;
            ScaleLine.Margin          = new Thickness(tStyle.TickMargin, 0, 0, 0);
            ScaleLine.StrokeThickness = tStyle.TickStrokeTickness;
            ScaleLine.Stroke          = new SolidColorBrush(Colors.Black);

            BlurEffect be = new BlurEffect();

            be.Radius        = 3;
            ScaleLine.Effect = be;
            ScalePanel.Children.Add(ScaleLine);
            return(ScalePanel);
        }
예제 #3
0
        /// <summary>
        /// Helper to load Settings and populate the form elements
        /// <see cref="Settings"/>
        /// </summary>
        public void LoadSettings()
        {
            // line
            LineThickness                   = Settings.LineThickness;
            tB_LineThickness.Text           = LineThickness.ToString();
            LineMaxLength                   = Settings.LineMaxLength;
            tB_LineMaxLength.Text           = LineMaxLength.ToString();
            LineDividerLengthFactor         = Settings.LineSubdividerLengthFactor;
            tB_LineDividerLengthFactor.Text = LineDividerLengthFactor.ToString();
            ScaleStyle = Settings.Style;
            lB_ScaleStyle.DataStore = Enum.GetNames(typeof(ScaleOverlay.ScaleStyle));

            // text
            TextHeight         = Settings.TextHeight;
            tB_TextHeight.Text = TextHeight.ToString();
            TextFont           = Settings.TextFont;
            fP_TextFont.Value  = TextFont.ToEtoFont();

            // position
            OffsetX         = Settings.OffsetX;
            tB_OffsetX.Text = OffsetX.ToString();
            OffsetY         = Settings.OffsetY;
            tB_OffsetY.Text = OffsetY.ToString();
            TextGap         = Settings.TextGap;
            tB_TextGap.Text = TextGap.ToString();

            // color
            LineColor = Settings.LineColor;
            btn_LineColor.BackgroundColor = LineColor.ToEto();
            TextColor = Settings.TextColor;
            btn_TextColor.BackgroundColor = TextColor.ToEto();
        }
예제 #4
0
        //重绘方法
        public void UIupdate()
        {
            GreatInit();
            DrawPointer();
            this.ScaleMarker.Children.Clear();//清除画板
            //计算尺度角
            var totalDegrees         = this.EndAngle - this.StartAngle;
            var degreeIncrement      = totalDegrees / (this.MajorTickCount);
            var labelIncrement       = (this.MaxValue - this.MinValue) / (this.MajorTickCount);
            var smallDegreeIncrement = degreeIncrement / (this.MinorTickCount + 1);

            ScaleStyle majorStyle = new ScaleStyle();
            ScaleStyle minorStyle = new ScaleStyle();
            //绘画出大刻度
            List <DockPanel> listDP = new List <DockPanel>();

            for (int i = 0; i <= this.MajorTickCount; i++)
            {
                majorStyle.TickAngle          = (i * degreeIncrement) + this.StartAngle;
                majorStyle.LineHeight         = 15;
                majorStyle.TickStrokeTickness = 5;
                majorStyle.TickMargin         = this.ScaleMargin;
                majorStyle.TickWidth          = this.Width;
                majorStyle.TickHeight         = this.Height;
                majorStyle.SLabelMargin       = this.ScaleLabelMargin;
                String tempTxt = ((i * labelIncrement) + this.MinValue).ToString();
                this.ScaleMarker.Children.Add(DrawScale(majorStyle));
                this.ScaleMarker.Children.Add(DrawScaleLable(majorStyle, tempTxt));

                for (int j = 0; j < +this.MinorTickCount; j++)
                {
                    if (i == this.MajorTickCount)
                    {
                        break;
                    }
                    minorStyle.TickAngle          = majorStyle.TickAngle + (j * smallDegreeIncrement) + smallDegreeIncrement;
                    minorStyle.TickStrokeTickness = 2;
                    minorStyle.LineHeight         = 10;
                    minorStyle.TickMargin         = this.ScaleMargin;
                    minorStyle.TickWidth          = this.Width;
                    minorStyle.TickHeight         = this.Height;
                    this.ScaleMarker.Children.Add(DrawScale(minorStyle));
                }
            }

            //绘画出数值框
            ValueLabel.Margin = new Thickness(0, 0, 0, VLMargin - 80);
            ValueLabel.Style  = ValueLabelStyle;
        }
예제 #5
0
        private void lB_ScaleStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            ScaleStyle = (ScaleStyle)Enum.Parse(typeof(ScaleStyle), lB_ScaleStyle.SelectedValue.ToString());
            switch (ScaleStyle)
            {
            case ScaleStyle.Line:
                tB_LineThickness.Enabled           = true;
                tB_LineDividerLengthFactor.Enabled = false;
                break;

            case ScaleStyle.Ruler:
                tB_LineDividerLengthFactor.Enabled = true;
                break;

            case ScaleStyle.Map:
                tB_LineDividerLengthFactor.Enabled = false;
                tB_LineThickness.Enabled           = false;
                break;

            default:
                break;
            }
        }
예제 #6
0
 public Scale(NoteSharp firstNote, ScaleStyle scaleStyle, NoteSequence scaleNotes)
 {
     FirstNote  = firstNote;
     ScaleStyle = scaleStyle;
     ScaleNotes = scaleNotes;
 }
예제 #7
0
      public void SetScaleStyle(ScaleStyle value, int i)
      {
        if (i < 0)
          throw new ArgumentOutOfRangeException("Index i is negative");
        if (i >= _styles.Length)
          throw new ArgumentOutOfRangeException("Index i is greater than length of internal array");

        ScaleStyle oldvalue = _styles[i];
        _styles[i] = value;

     
      }
예제 #8
0
      void CopyFrom(ScaleStyle from)
      {
        this.GridStyle = from._gridStyle == null ? null : (GridStyle)from._gridStyle.Clone();

        this._axisStyles.Clear();
        for (int i = 0; i < _axisStyles.Count; ++i)
        {
          this.AddAxisStyle((AxisStyle)from._axisStyles[i].Clone());
        }
      }