Пример #1
0
        public override void OnRefresh()
        {
            base.OnRefresh();

            DataGrid.BringToFront();
            FilterBox.Text = XmlHelper.Value(Data, "Filter");
        }
        public override void OnRefresh()
        {
            base.HelpText = "Select fields by clicking on the column(s) at the bottom.";

            DataProcessor Processor = new DataProcessor();
            XmlDocument   Doc       = new XmlDocument();

            ApsimFile.Component c = Controller.ApsimData.Find(NodePath + "/Observed");
            if (c != null)
            {
                Doc.LoadXml(Controller.ApsimData.Find(NodePath + "/Observed").FullXML());
                DataGrid.DataSource = Processor.Go(Doc.DocumentElement, NodePath);
            }
            foreach (DataGridViewColumn Col in DataGrid.Columns)
            {
                Col.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            DataGrid.BringToFront();

            List <string> ListValues = XmlHelper.Values(Data, "FieldsToMatch");

            string[] Values = new string[ListValues.Count];
            ListValues.CopyTo(Values, 0);
            FieldNames.Items.Clear();
            FieldNames.Items.AddRange(Values);
            FieldNames.BackColor = HightlightColour;

            base.OnColumnClickEvent -= OnColumnClick;
            base.OnColumnClickEvent += OnColumnClick;
        }
Пример #3
0
        /// <summary>
        /// Fill the datagrid with data.
        /// </summary>
        private void FillDataGrid()
        {
            if (DataList.Text != "")
            {
                DataGrid.DataSource = Chart.GetDataSourceWithName(DataList.Text);

                DataGrid.BringToFront();
                foreach (DataGridViewColumn Col in DataGrid.Columns)
                {
                    Col.SortMode = DataGridViewColumnSortMode.NotSortable;
                }
            }
        }
Пример #4
0
        public override void OnRefresh()
        {
            // -----------------------------------------------
            // Called when it's time to refresh the canvas and
            // everything on it.
            // -----------------------------------------------
            base.OnRefresh();

            DataGrid.BringToFront();

            // populate x and y edit boxes.
            X.Items.Clear();
            Y.Items.Clear();

            LoadListBox(X, "X", "");
            LoadListBox(X, "XTop", "Top axis: ");
            LoadListBox(Y, "Y", "");
            LoadListBox(Y, "YRight", "Right axis: ");

            // setup the type drop downs.
            TypeCombo.Text  = XmlHelper.Value(Data, "SeriesType");
            PointCombo.Text = XmlHelper.Value(Data, "PointType");

            // see if all X variables are to be on top axis .e.g. Depth plots.
            AllXOnTopAxis = DataGrid.Columns.Count > 2 &&
                            DataGrid.Columns[0].Name == "Date" &&
                            DataGrid.Columns[1].Name == "Depth";

            base.OnColumnClickEvent -= OnColumnClick;
            base.OnColumnClickEvent += OnColumnClick;
            if (Y.Items.Count == 0 && X.Items.Count != 0)
            {
                TransitionToY();
            }
            else
            {
                TransitionToX();
            }

            string ColourString = XmlHelper.Value(Data, "colour");

            SpecificColourCheckBox.Checked = (ColourString != "");
            if (ColourString != "")
            {
                ColourButton.Color = Color.FromArgb(Convert.ToInt32(ColourString));
            }

            OnSpecificColourChange(null, null);
        }
Пример #5
0
 /// <summary>
 /// 当触发控件为文本框或者组合框时设定选项网格的上边距与左边距
 /// </summary>
 /// <param name="occurTextBox">触发文本框</param>
 /// <param name="cardGrid">选项网格</param>
 /// <param name="parentCtrl">父级控件</param>
 /// <param name="oppositeTop">在父控件中的相对纵坐标</param>
 /// <param name="oppositeLeft">在父控件中的相对横坐标</param>
 public static void SetCardGridTopAndLeft(Control occurTextBox, DataGrid cardGrid, Control parentCtrl, int oppositeTop, int oppositeLeft)
 {
     //将网格放在触发文本框上面或下面都不合适
     if (parentCtrl.Height < cardGrid.Height + occurTextBox.Height + oppositeTop && oppositeTop < cardGrid.Height)
     {
         #region 高度不适合
         if (parentCtrl.Parent != null)
         {
             SetCardGridTopAndLeft(occurTextBox, cardGrid, parentCtrl.Parent, oppositeTop + parentCtrl.Top, oppositeLeft + parentCtrl.Left);
         }
         #endregion
     }
     else
     {
         #region 高度适合
         cardGrid.Parent = parentCtrl;
         cardGrid.BringToFront();
         if (parentCtrl.Height < cardGrid.Height + occurTextBox.Height + oppositeTop)            //如果其下边界超出父容器底边界则底部与父容器底边界对齐
         {
             cardGrid.Top = oppositeTop - cardGrid.Height;
         }
         else
         {
             cardGrid.Top = oppositeTop + occurTextBox.Height;
         }
         if (parentCtrl.Width < cardGrid.Width + oppositeLeft)
         {
             cardGrid.Left = oppositeLeft - (cardGrid.Width - occurTextBox.Width);
             if (cardGrid.Left < 0)      //宽度不适合
             {
                 if (parentCtrl.Parent != null)
                 {
                     SetCardGridTopAndLeft(occurTextBox, cardGrid, parentCtrl.Parent, oppositeTop + parentCtrl.Top, oppositeLeft + parentCtrl.Left);
                 }
             }
         }
         else
         {
             cardGrid.Left = oppositeLeft;
         }
         #endregion
     }
 }
Пример #6
0
        public override void OnRefresh()
        {
            base.OnRefresh();

            DataGrid.BringToFront();

            string St = XmlHelper.Value(Data, "FileName");

            if (St != FileNameBox.Text)
            {
                FileNameBox.Text = XmlHelper.Value(Data, "FileName");
            }

            St = XmlHelper.Value(Data, "Experiment");
            if (St != ExperimentCmboBox.Text)
            {
                ExperimentCmboBox.Text = XmlHelper.Value(Data, "Experiment");
                LookupExperimentNames();
            }
            St = XmlHelper.Value(Data, "Treatment");
            if (St != TreatmentComboBox.Text)
            {
                TreatmentComboBox.Text = XmlHelper.Value(Data, "Treatment");
                LookupTreatmentNames();
            }

            St = XmlHelper.Value(Data, "DataSource");
            if (St != DataSourceComboBox.Text)
            {
                DataSourceComboBox.Text = XmlHelper.Value(Data, "DataSource");
            }

            if (DataSourceComboBox.Items.Count == 0)
            {
                DataSourceComboBox.Items.Add("Plot");
                DataSourceComboBox.Items.Add("Crop");
            }
            // need to populate drop downs from MDB
        }