private static void SetTextBlockPos(DeepPanel control, int count) { if (count == 0) { return; } 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("0.00"); 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); } }
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("0.00"); } #endregion }
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); }
private static void SetLinePos(DeepPanel control, int count) { if (count == 0) { return; } 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); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.UserControl = ((LoggingDataManager.WPFGraph.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 = ((LoggingDataManager.WPFGraph.GridMap)(target)); return; case 8: this.STK_GraphContainer2 = ((System.Windows.Controls.StackPanel)(target)); return; case 9: this.UC_Gm2 = ((LoggingDataManager.WPFGraph.GridMap)(target)); return; case 10: this.STK_GraphContainer3 = ((System.Windows.Controls.StackPanel)(target)); return; case 11: this.UC_Gm3 = ((LoggingDataManager.WPFGraph.GridMap)(target)); return; case 12: this.UC_Dp = ((LoggingDataManager.WPFGraph.DeepPanel)(target)); return; case 13: this.TB_dEPTH = ((System.Windows.Controls.TextBlock)(target)); return; case 14: this.SL_Main = ((System.Windows.Controls.Slider)(target)); return; case 15: this.CKB_AutoScroll = ((System.Windows.Controls.CheckBox)(target)); return; case 16: this.CKB_ShowLine = ((System.Windows.Controls.CheckBox)(target)); return; case 17: this.line = ((System.Windows.Shapes.Line)(target)); return; case 18: this.line1 = ((System.Windows.Shapes.Line)(target)); return; case 19: this.line2 = ((System.Windows.Shapes.Line)(target)); return; case 20: this.line3 = ((System.Windows.Shapes.Line)(target)); return; case 21: this.line4 = ((System.Windows.Shapes.Line)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 2: this.STK_CurveGroupContainer1 = ((System.Windows.Controls.Grid)(target)); return; case 3: this.UC_PT = ((LoggingDataManager.WPFGraph.ParaTable)(target)); return; case 4: this.GD_GraphContainer = ((System.Windows.Controls.Grid)(target)); return; case 5: this.UC_Gm = ((LoggingDataManager.WPFGraph.GridMap)(target)); return; case 6: this.CA_OverLay = ((System.Windows.Controls.Canvas)(target)); return; case 7: this.REC_Overlay = ((System.Windows.Controls.Border)(target)); return; case 8: this.UC_Dp = ((LoggingDataManager.WPFGraph.DeepPanel)(target)); return; case 9: this.BTN_ZoomIn = ((System.Windows.Controls.Button)(target)); return; case 10: this.BTN_Back = ((System.Windows.Controls.Button)(target)); return; case 11: this.BTN_Move = ((System.Windows.Controls.Button)(target)); return; case 12: this.BTN_Delete = ((System.Windows.Controls.Button)(target)); return; case 13: this.CKB_ShowGrid = ((System.Windows.Controls.CheckBox)(target)); return; case 14: this.TBK_dEPTH = ((System.Windows.Controls.TextBlock)(target)); return; case 15: this.SL_Main = ((System.Windows.Controls.Slider)(target)); return; case 16: this.TBK_Zoom = ((System.Windows.Controls.TextBlock)(target)); return; case 17: this.SL_Zoom = ((System.Windows.Controls.Slider)(target)); return; case 18: this.line = ((System.Windows.Shapes.Line)(target)); return; case 19: this.line1 = ((System.Windows.Shapes.Line)(target)); return; case 20: this.line2 = ((System.Windows.Shapes.Line)(target)); return; case 21: this.line3 = ((System.Windows.Shapes.Line)(target)); return; } this._contentLoaded = true; }