Beispiel #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_QianDong.Rows.Count != _Count)
            {
                Data_QianDong.Rows.Clear();

                for (int i = 0; i < _Count; i++)
                {
                    int Index = Data_QianDong.Rows.Add();
                    if ((Index + 1) % 2 == 0)
                    {
                        Data_QianDong.Rows[Index].DefaultCellStyle.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Alter;
                    }
                    else
                    {
                        Data_QianDong.Rows[Index].DefaultCellStyle.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Normal;
                    }
                    Data_QianDong.Rows[Index].Cells[0].Style.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Frone;
                    Data_QianDong.Rows[Index].Cells[1].Style.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Frone;
                }
            }
            Data_QianDong.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            Data_QianDong.Refresh();
        }
Beispiel #2
0
        /// <summary>
        /// 要检,不检,切换事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Data_QianDong_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_QianDong[e.ColumnIndex, e.RowIndex].ReadOnly)
            {
                return;                                                         //如果是只读则退出!
            }
            if (ParentMain.Evt_OnYaoJianChanged != null)
            {
                bool Yn;
                if ((bool)Data_QianDong.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)
                {
                    Yn = false;
                    Data_QianDong.EndEdit();
                }
                else
                {
                    Yn = true;
                    Data_QianDong.EndEdit();
                }
                Data_QianDong.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);
            }
        }