Example #1
0
        private void DealWithModifyCellValue(int curRowIndex, int curColIndex)
        {
            DataGridViewDisableComboBoxCell comBoxCell = null;

            if (curColIndex == (int)ColType.IsConnect)
            {
                comBoxCell = dbfDataGridView_ComplexLayout[(int)ColType.Count, curRowIndex] as DataGridViewDisableComboBoxCell;
                if ((bool)dbfDataGridView_ComplexLayout[(int)ColType.IsConnect, curRowIndex].Value)
                {
                    dbfDataGridView_ComplexLayout[(int)ColType.IsConnect, curRowIndex].Value = false;
                    comBoxCell.Enabled      = false;
                    _countList[curRowIndex] = 0;
                }
                else
                {
                    dbfDataGridView_ComplexLayout[(int)ColType.IsConnect, curRowIndex].Value = true;
                    comBoxCell.Enabled      = true;
                    _countList[curRowIndex] = Convert.ToByte(comBoxCell.Value);
                }
                if (SetComplexScreenInfEvent != null)
                {
                    SetComplexScreenInfEvent.Invoke(_addrList[curRowIndex], _countList[curRowIndex]);
                }
            }
            else if (curColIndex == (int)ColType.Count)
            {
                comBoxCell = dbfDataGridView_ComplexLayout[(int)ColType.Count, curRowIndex] as DataGridViewDisableComboBoxCell;;
                _countList[curRowIndex] = Convert.ToByte(comBoxCell.Value);
                if (SetComplexScreenInfEvent != null)
                {
                    SetComplexScreenInfEvent.Invoke(_addrList[curRowIndex], _countList[curRowIndex]);
                }
            }
        }
Example #2
0
        public override object Clone()
        {
            DataGridViewDisableComboBoxCell cell =
                (DataGridViewDisableComboBoxCell)base.Clone();

            cell.Enabled = this.Enabled;
            return(cell);
        }
Example #3
0
        /// <summary>
        /// 添加一个接收卡的监控信息
        /// </summary>
        /// <param name="addr"></param>
        /// <param name="info"></param>
        public void AddOneMonitorCardInf(string addr, byte count)
        {
            _countList.Add(count);
            _addrList.Add(addr);
            dbfDataGridView_ComplexLayout.RowCount++;
            int    nRowIndex = dbfDataGridView_ComplexLayout.RowCount - 1;
            bool   isConnect = false;
            string countStr  = CountArray[0];

            if (count > 0)
            {
                isConnect = true;
                countStr  = count.ToString();
            }

            string commPort       = "";
            byte   senderIndex    = 0;
            byte   portIndex      = 0;
            UInt16 scanBoardIndex = 0;

            StaticFunction.GetPerAddr(addr, out commPort, out senderIndex, out portIndex, out scanBoardIndex);
            dbfDataGridView_ComplexLayout.Rows[nRowIndex].SetValues(new object[]
            {
                isConnect,
                commPort,
                (senderIndex + 1).ToString(),
                (portIndex + 1).ToString(),
                (scanBoardIndex + 1).ToString(),
                countStr
            });

            DataGridViewDisableComboBoxCell comBoxCell = dbfDataGridView_ComplexLayout[(int)ColType.Count, nRowIndex] as DataGridViewDisableComboBoxCell;;

            if (isConnect)
            {
                comBoxCell.Enabled = true;
            }
            else
            {
                comBoxCell.Enabled = false;
            }
            this.Refresh();
        }
Example #4
0
 private void dbfDataGridView_ComplexLayout_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex < 0 || e.ColumnIndex >= dbfDataGridView_ComplexLayout.ColumnCount)
     {
         return;
     }
     if (e.RowIndex < 0 || e.RowIndex >= dbfDataGridView_ComplexLayout.RowCount)
     {
         return;
     }
     if (e.ColumnIndex == (int)ColType.Count)
     {
         DataGridViewDisableComboBoxCell comBoxCell = null;
         comBoxCell             = dbfDataGridView_ComplexLayout[(int)ColType.Count, e.RowIndex] as DataGridViewDisableComboBoxCell;;
         _countList[e.RowIndex] = Convert.ToByte(comBoxCell.Value);
         if (SetComplexScreenInfEvent != null)
         {
             SetComplexScreenInfEvent.Invoke(_addrList[e.RowIndex], _countList[e.RowIndex]);
         }
     }
 }
Example #5
0
        /// <summary>
        /// 设置选中项的个数
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public bool SetCountForSelectedItems(byte count)
        {
            if (count > CountArray.Length)
            {
                return(false);
            }
            DataGridViewDisableComboBoxCell comBoxCell = null;
            bool isConnect = false;
            int  nIndex    = 0;

            if (count > 0)
            {
                isConnect = true;
            }
            else
            {
                isConnect = false;
            }
            for (int i = 0; i < dbfDataGridView_ComplexLayout.SelectedRows.Count; i++)
            {
                nIndex             = dbfDataGridView_ComplexLayout.SelectedRows[i].Index;
                comBoxCell         = dbfDataGridView_ComplexLayout[(int)ColType.Count, nIndex] as DataGridViewDisableComboBoxCell;
                _countList[nIndex] = count;
                if (isConnect)
                {
                    comBoxCell.Value = count.ToString();
                }
                comBoxCell.Enabled = isConnect;
                dbfDataGridView_ComplexLayout[(int)ColType.IsConnect, nIndex].Value = isConnect;
                if (SetComplexScreenInfEvent != null)
                {
                    SetComplexScreenInfEvent.Invoke(_addrList[nIndex], _countList[nIndex]);
                }
            }
            dbfDataGridView_ComplexLayout.Refresh();
            return(true);
        }