示例#1
0
 private void FindMax(GridsRow gr)
 {
     if (gr.Content.Length > maxGridRowLen)
     {
         maxGridRowLen = gr.Content.Length;
     }
 }
示例#2
0
        public void AddTable(string Header, string[] RowTitles, Array data)
        {
            if (data == null)
            {
                throw new ArgumentNullException();
            }
            if (!(data.GetValue(0) is Array))
            {
                AddRow(Header, data);
                return;
            }

            if (rows == null)
            {
                rows = new List <GridsRow>();
            }

            int _need_header = (Header == null ? 0 : 1);

            GridsRow[] grRows = new GridsRow[data.GetLength(0) + _need_header];
            if (_need_header == 1)
            {
                grRows[0].Title   = "";
                grRows[0].Content = new string[] { Header };
                rows.Add(grRows[0]);
            }

            bool hasTitles = false;

            if (RowTitles != null)
            {
                if (RowTitles.Length == data.GetLength(0))
                {
                    hasTitles = true;
                }
            }

            for (int i = _need_header; i < data.GetLength(0) + _need_header; i++)
            {
                grRows[i].Title   = hasTitles ? RowTitles[i] : "Х";
                grRows[i].Content = (Array)data.GetValue(i - _need_header);
                rows.Add(grRows[i]);
            }

            UpdateGrid();
        }