public ChangeScaleWindow(ColumnScale scale, double colWidth) { InitializeComponent(); initializeTextBox(scale, colWidth); }
private void initializeTextBox(ColumnScale scale, double colWidth) { _columnscale = scale; _colWidth = colWidth; this.scaleBox.Text = ((_columnscale.Scale) * _columnscale.CanvasHeight).ToString(); }
private void initializeData(double width, DataModel model, String path) { // 初始化图形属性 XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNode node = doc.SelectSingleNode("Diagram/ColumnHeader/Height"); _headerHeight = Int32.Parse(node.InnerText); node = doc.SelectSingleNode("Diagram/ColumnBody/CanvasHeight"); _bodyHeight = Int32.Parse(node.InnerText); node = doc.SelectSingleNode("Diagram/ScaleColumn/ShowHeight"); _showHeight = Int32.Parse(node.InnerText); // 初始化数据元素 _width = width; _colWidth = adjustColumnWidth(width, model.DefaultColumnNumber); _model = model; _columns = new List<Column>(); _headerPanel = new StackPanel(); _headerPanel.Orientation = Orientation.Horizontal; _bodyViewer = new ScrollViewer(); _bodyViewer.Height = Int32.Parse(doc.SelectSingleNode("Diagram/BodyViewer/Height").InnerText); _bodyPanel = new StackPanel(); _bodyPanel.Orientation = Orientation.Horizontal; _bodyViewer.Content = _bodyPanel; List<List<Data>> list = new List<List<Data>>(); for (int i = 0; i < _model.DefaultColumnNumber; ++i) { List<Data> datalist = new List<Data>(); list.Add(datalist); } for (int i = 0; i < _model.DataList.Count; ++i) { Data d = _model.DataList.ElementAt(i); if (d.DefaultColumnPos.Count == 0) continue; for (int j = 0; j < d.DefaultColumnPos.Count; ++j) { list.ElementAt(d.DefaultColumnPos.ElementAt(j) - 1).Add(d); } } _scale = new ColumnScale(_model.DEPTMEAS.Min, _model.DEPTMEAS.Max, _colWidth, _showHeight, _headerHeight, _bodyHeight); _headerPanel.Children.Add(_scale.Header); _bodyPanel.Children.Add(_scale.Body); for (int i = 0; i < _model.DefaultColumnNumber; ++i) { Column c = new Column(_colWidth, _headerHeight, _bodyHeight, list.ElementAt(i), _model.DEPTMEAS.DData.Min(), _model.DEPTMEAS.DData.Max(), _scale.Scale, _model); _columns.Add(c); _headerPanel.Children.Add(c.Header); _bodyPanel.Children.Add(c.Body); } }