Exemplo n.º 1
0
 private static void SetTextBlockPos(DeepPanel control, int count)
 {
     if (count != control.lineList.Count)
     {
         return;
     }
     for (int i = 0; i < count; i++)
     {
         Line      line = control.lineList[i];
         TextBlock tb   = new TextBlock();
         tb.Width         = 65;
         tb.Height        = 16;
         tb.TextAlignment = TextAlignment.Center;
         tb.Background    = control.LayoutRoot.Background;
         tb.Text          = (control.depthDeltaValue * i + control.depthBaseValue).ToString();
         control.LayoutRoot.Children.Add(tb);
         control.textBlockList.Add(tb);
         double centerLeft = (line.X1 + line.X2) / 2;
         double centerTop  = (line.Y1 + line.Y2) / 2;
         double left       = centerLeft - 0.5 * tb.Width;
         double top        = centerTop - 0.5 * tb.Height;
         Canvas.SetLeft(tb, left);
         Canvas.SetTop(tb, top);
     }
 }
Exemplo n.º 2
0
        private static void VerticalOffsetPropertyOnValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            DeepPanel pt      = o as DeepPanel;
            double    offset  = (double)e.NewValue;
            double    uHeight = pt.LayoutRoot.ActualHeight / pt.VerticalGraduationCount;
            int       n       = (int)(offset / uHeight);

            #region LinesChange
            for (int i = 0; i < pt.lineList.Count; i++)
            {
                Line   line = pt.lineList[i];
                double y    = (n + 1) * uHeight - offset + i * uHeight;
                line.Y1 = y;
                line.Y2 = y;
            }
            #endregion
            #region TBKsChange
            for (int i = 0; i < pt.textBlockList.Count; i++)
            {
                TextBlock tb        = pt.textBlockList[i];
                Line      line      = pt.lineList[i];
                double    centerTop = (line.Y1 + line.Y2) / 2;
                double    top       = centerTop - 0.5 * tb.Height;
                Canvas.SetTop(tb, top);
                double representValue = pt.DepthBaseValue + (1 + i + n) * pt.DepthDeltaValue;
                tb.Text = (representValue).ToString();
            }
            #endregion
        }
Exemplo n.º 3
0
        private static void VerticalGraduationCountOnValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            DeepPanel pt = o as DeepPanel;

            pt.VerticalOffset = 0;
            int count = (int)e.NewValue;

            pt.LayoutRoot.Children.Clear();
            pt.lineList.Clear();
            pt.textBlockList.Clear();
            SetLinePos(pt, count);
            SetTextBlockPos(pt, count);
        }
Exemplo n.º 4
0
        private static void SetLinePos(DeepPanel control, int count)
        {
            double uHeight = control.ActualHeight / count;

            for (int i = 0; i < count; i++)
            {
                Line line = new Line();
                line.Stroke = new SolidColorBrush(Colors.Black);
                line.Width  = control.LayoutRoot.ActualWidth;
                line.Height = control.LayoutRoot.ActualHeight;
                line.X1     = 0;
                line.Y1     = uHeight * i;
                line.Y2     = uHeight * i;
                line.X2     = control.LayoutRoot.ActualWidth;
                control.LayoutRoot.Children.Add(line);
                control.lineList.Add(line);
            }
        }
Exemplo n.º 5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((WPFGraphics.Graph)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.STK_CurveGroupContainer1 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 4:
                this.STK_CurveGroupContainer2 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 5:
                this.STK_CurveGroupContainer3 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 6:
                this.STK_GraphContainer1 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 7:
                this.UC_Gm1 = ((WPFGraphics.GridMap)(target));
                return;

            case 8:
                this.STK_GraphContainer2 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 9:
                this.UC_Gm2 = ((WPFGraphics.GridMap)(target));
                return;

            case 10:
                this.STK_GraphContainer3 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 11:
                this.UC_Gm3 = ((WPFGraphics.GridMap)(target));
                return;

            case 12:
                this.UC_Dp = ((WPFGraphics.DeepPanel)(target));
                return;

            case 13:
                this.line = ((System.Windows.Shapes.Line)(target));
                return;

            case 14:
                this.line1 = ((System.Windows.Shapes.Line)(target));
                return;

            case 15:
                this.line2 = ((System.Windows.Shapes.Line)(target));
                return;

            case 16:
                this.line3 = ((System.Windows.Shapes.Line)(target));
                return;
            }
            this._contentLoaded = true;
        }