示例#1
0
        /// <summary>
        /// 初始化数据菜单
        /// </summary>
        /// <param name="MeterGroup"></param>
        private void InitializationGrid(CLDC_DataCore.Model.DnbModel.DnbGroupInfo MeterGroup)
        {
            if (CLDC_DataCore.Function.Common.IsVSDevenv())
            {
                return;
            }

            int _Count = MeterGroup.MeterGroup.Count;

            if (Data_Error.Rows.Count != _Count)           //初始化右部数据表单
            {
                Data_Error.Rows.Clear();
                for (int i = 0; i < _Count; i++)
                {
                    int index = Data_Error.Rows.Add();
                    if ((index + 1) % 2 == 0)
                    {
                        Data_Error.Rows[index].DefaultCellStyle.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Alter;
                    }
                    else
                    {
                        Data_Error.Rows[index].DefaultCellStyle.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Normal;
                    }
                    Data_Error.Rows[index].Cells[0].Style.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Frone;
                    Data_Error.Rows[index].Cells[1].Style.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Frone;
                }
            }

            Data_Error.Refresh();
        }
        /// <summary>
        /// 设置创建表格列的样式
        /// </summary>
        /// <param name="Index">列下标</param>
        private void CreateColumnStyle(CLDC_DataCore.Model.DnbModel.DnbGroupInfo MeterGroup, StPlan_SpecalCheck Item)
        {
            if (Data_Error.Columns.Count != Item.WcCheckNumic + 4 + 2)          //如果误差数据表格的列数大于默认列数,则需要删除大于部分 误差次数+固定列+平均值,化整值列
            {
                for (int i = Data_Error.Columns.Count - 1; i > 3; i--)
                {
                    Data_Error.Columns.RemoveAt(i);
                }


                for (int i = 0; i < Item.WcCheckNumic; i++)
                {
                    Data_Error.Columns.Add("Tmp_Col" + i.ToString(), "误差" + (i + 1).ToString());
                }

                Data_Error.Columns.Add("Tmp_Pj", "平均值");

                Data_Error.Columns.Add("Tmp_Hz", "化整值");
            }

            float _FillWeight = 100F / (Data_Error.Columns.Count - 4);

            for (int i = 4; i < Data_Error.Columns.Count; i++)
            {
                DataGridViewColumn _Column = Data_Error.Columns[i];
                _Column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                _Column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                _Column.FillWeight   = _FillWeight;
            }
            Data_Error.Refresh();
        }
        /// <summary>
        /// 表位行选中,选择是否要检
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Data_Error_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex != 0 || e.RowIndex == -1)
            {
                if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
                {
                    try
                    {
                        this.GridSelectRowIndexChanged(e.RowIndex);
                    }
                    catch
                    { }
                }
                return;     //如果不是第一列,则退出
            }
            try
            {
                this.GridSelectRowIndexChanged(e.RowIndex);
            }
            catch { }

            if (Data_Error[e.ColumnIndex, e.RowIndex].ReadOnly)
            {
                return;                                                      //如果是只读则退出!
            }
            if (ParentMain.Evt_OnYaoJianChanged != null)
            {
                bool Yn;
                if ((bool)Data_Error.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)
                {
                    Yn = false;
                    Data_Error.EndEdit();
                }
                else
                {
                    Yn = true;
                    Data_Error.EndEdit();
                }
                Data_Error.Enabled = false;
                //Comm.Function.TopWaiting.ShowWaiting("正在更改...");
                ParentMain.Evt_OnYaoJianChanged(_TaiType, _TaiID, e.RowIndex, Yn);
                //Comm.Function.TopWaiting.HideWaiting();
            }
            else
            {
                MessageBoxEx.Show(this, "没有处理事件Evt_OnYaoJianChanged", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#4
0
        /// <summary>
        /// 设置创建表格列的样式
        /// </summary>
        /// <param name="Index">列下标</param>
        private void CreateColumnStyle()
        {
            if (Data_Error.Columns.Count <= 3)
            {
                return;
            }

            float _FillWeight = 100F / (Data_Error.Columns.Count - 3);

            for (int i = 3; i < Data_Error.Columns.Count; i++)
            {
                DataGridViewColumn _Column = Data_Error.Columns[i];
                _Column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                _Column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                _Column.FillWeight   = _FillWeight;
                _Column.SortMode     = DataGridViewColumnSortMode.NotSortable;
            }
            Data_Error.Refresh();
        }