// 设置模式:编辑与非编辑,默认是非编辑模式
        public void SetEditable(bool bEditable)
        {
            m_bIsEditable = bEditable;
            if (m_bIsEditable)
            {
                // 编辑模式
                // 设定标题栏,默认有个隐藏列
                this.Header = new string[]
                {
                    CS_Delete, CS_StationID, CS_StationName, CS_TimeCollected, CS_Voltage, CS_DataState, CS_TimeReceived, CS_ChannelType, CS_MsgType
                };

                //   this.HideColomns = new int[] { 7};

                //开启编辑模式,设置可编辑列
                DataGridViewCheckBoxColumn deleteCol = new DataGridViewCheckBoxColumn();
                base.SetColumnEditStyle(0, deleteCol);

                //// 设置采集时间编辑列
                //CalendarColumn collectionCol = new CalendarColumn();
                //base.SetColumnEditStyle(2, collectionCol);

                // 累计电压编辑列
                DataGridViewNumericUpDownColumn voltage = new DataGridViewNumericUpDownColumn()
                {
                    Minimum       = 0,
                    Maximum       = 65537,
                    DecimalPlaces = 2 /*好像是设置小数点后面的位数*/
                };
                base.SetColumnEditStyle(4, voltage);

                // 数据状态,可编辑列
                DataGridViewComboBoxColumn dataStateCol = new DataGridViewComboBoxColumn();
                dataStateCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
                dataStateCol.Items.AddRange(new object[] { CS_DataState_Normal, CS_DataState_AbNormal });
                base.SetColumnEditStyle(5, dataStateCol);

                // 接收时间
                CalendarColumn recvTime = new CalendarColumn();
                base.SetColumnEditStyle(6, recvTime);

                // 通讯方式,不可编辑

                // 报文类型,不可编辑

                // 设置删除列的宽度
                this.Columns[0].Width = 40; //删除列宽度为20
                this.Columns[3].Width = 125;
                this.Columns[5].Width = 125;
            }
            else
            {
                this.Columns[2].Width = 125;
                this.Columns[4].Width = 125;
            }
        }
        public void SetEditable(bool bEditable)
        {
            m_bIsEditable = bEditable;
            if (m_bIsEditable)
            {
                // 设定标题栏,默认有个隐藏列
                this.Header = new string[]
                {
                    CS_Delete, CS_StationID, CS_StationName, CS_TimeCollected, CS_TotalRain, CS_DifferenceRain, CS_PeriodRain, CS_DayRain, CS_DataState, CS_TimeReceived, CS_ChannelType, CS_MsgType
                };
                //  this.HideColomns = new int[] { 10 };

                //开启编辑模式,设置可编辑列

                DataGridViewCheckBoxColumn deleteCol = new DataGridViewCheckBoxColumn();
                base.SetColumnEditStyle(0, deleteCol);

                //// 设置采集时间编辑列
                //CalendarColumn collectionCol = new CalendarColumn();
                //base.SetColumnEditStyle(3, collectionCol);

                // 累计雨量编辑列
                DataGridViewNumericUpDownColumn totalRain = new DataGridViewNumericUpDownColumn()
                {
                    Minimum       = 0,
                    Maximum       = 65537,
                    DecimalPlaces = 1 /*好像是设置小数点后面的位数*/
                };
                base.SetColumnEditStyle(4, totalRain);

                //// 差值雨量编辑列
                //DataGridViewNumericUpDownColumn differneceRain = new DataGridViewNumericUpDownColumn()
                //{
                //    Minimum = 0,
                //    Maximum = 65537,
                //    DecimalPlaces = 1 /*好像是设置小数点后面的位数*/

                //};
                //base.SetColumnEditStyle(5, differneceRain);

                //// 时段雨量编辑列
                //DataGridViewNumericUpDownColumn periodRain = new DataGridViewNumericUpDownColumn()
                //{
                //    Minimum = 0,
                //    Maximum = 65537,
                //    DecimalPlaces = 1 /*好像是设置小数点后面的位数*/

                //};
                //base.SetColumnEditStyle(6, periodRain);

                //// 日雨量
                //DataGridViewNumericUpDownColumn dayRain = new DataGridViewNumericUpDownColumn()
                //{
                //    Minimum = 0,
                //    Maximum = 65537,
                //    DecimalPlaces = 1 /*好像是设置小数点后面的位数*/

                //};
                //base.SetColumnEditStyle(7, dayRain);

                // 数据状态,可编辑列
                DataGridViewComboBoxColumn dataStateCol = new DataGridViewComboBoxColumn();
                dataStateCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
                dataStateCol.Items.AddRange(new object[] { CS_DataState_Normal, CS_DataState_AbNormal, CS_DataState_Warning });
                base.SetColumnEditStyle(8, dataStateCol);

                // 接收时间
                CalendarColumn recvTime = new CalendarColumn();
                base.SetColumnEditStyle(9, recvTime);


                // 通讯方式,不可编辑

                // 报文类型,不可编辑


                // 设置删除列的宽度
                this.Columns[0].Width = 40; //删除列宽度为20
                this.Columns[1].Width = 60;
                this.Columns[3].Width = 125;
                this.Columns[4].Width = 70;
                this.Columns[5].Width = 70;
                this.Columns[6].Width = 70;
                this.Columns[7].Width = 70;
                this.Columns[8].Width = 60;
                this.Columns[9].Width = 125; // 接收时间
            }
            else
            {
                this.Columns[0].Width = 60;
                this.Columns[2].Width = 125;
                this.Columns[3].Width = 70;
                this.Columns[4].Width = 70;
                this.Columns[5].Width = 70;
                this.Columns[6].Width = 70;
                this.Columns[7].Width = 60;
                this.Columns[8].Width = 125; // 接收时间
                //this.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                //this.Columns[8].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            }
        }