示例#1
0
        private void Initialize()
        {
            int index;

            stringRows = new List <StringRow>();
            StringRow row = new StringRow(0);

            if ((string.IsNullOrWhiteSpace(sets) == true) || (sets == "None"))
            {
                row.Sets.DDWord(0, 0);
            }
            else
            {
                string[] states = sets.Trim().Split(',');

                for (int i = 0; i < states.Length; i++)
                {
                    try
                    {
                        index           = int.Parse(states[i].Trim()) - 1;
                        row.Sets[index] = true;
                    }
                    catch
                    {
                    }
                }
            }

            stringRows.Add(row);

            smuGrid.DataSource = stringRows;
            smuGridView.BeginUpdate();

            try
            {
                smuGridView.Columns.Clear();

                for (int i = 0; i < count; i++)
                {
                    smuGridView.Columns.Add(CreateGridColumn(i + 1, $"SMU{i + 1}", $"SMU{i + 1}", 64, true, true));
                }
            }
            finally
            {
                smuGridView.EndUpdate();
            }
        }
        private void RefreshSmuGrid(int smuCount, int stringCount)
        {
            stringRows.Clear();

            for (int i = 0; i < stringCount; i++)
            {
                StringRow row = new StringRow(i);

                stringRows.Add(row);
            }

            smuGridView.BeginUpdate();

            try
            {
                GridColumn col = smuGridView.Columns[0];
                col.AppearanceCell.BackColor            = Color.FromArgb(245, 245, 247);
                col.AppearanceCell.Options.UseBackColor = true;
                col.Visible      = true;
                col.VisibleIndex = 1;

                for (int i = 0; i < smuCount; i++)
                {
                    col = smuGridView.Columns[i + 1];
                    col.AppearanceCell.BackColor              = Color.White;
                    col.AppearanceCell.Options.UseBackColor   = true;
                    col.AppearanceHeader.BackColor            = Color.FromKnownColor(AppRes.Properties.SmuColors[i]);
                    col.AppearanceHeader.Options.UseBackColor = true;
                    col.Visible      = true;
                    col.VisibleIndex = i + 2;
                }
            }
            finally
            {
                smuGridView.EndUpdate();
            }
        }