private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 | e.RowIndex < 0) { return; } if (dataGridView1.Columns[e.ColumnIndex].Name == columnConfig) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells[columnConfig]; if (buttonCell.Enabled) { //MessageBox.Show(dataGridView1.Rows[e.RowIndex]. // Cells[e.ColumnIndex].Value.ToString() + // " is enabled"); modbusmasterDeviceform form = new modbusmasterDeviceform(); ModbusMasterData data = masterManage.modbusMastrList.ElementAt(e.RowIndex); form.getMasterData(ref data); form.ShowDialog(); } } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 | e.RowIndex < 0) { return; } if (dataGridView1.Columns[e.ColumnIndex].Index == (int)COLUMNNAME.CHANNEL) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells[(int)COLUMNNAME.CHANNEL]; if (buttonCell.Enabled) { //MessageBox.Show(dataGridView1.Rows[e.RowIndex]. // Cells[e.ColumnIndex].Value.ToString() + // " is enabled"); //刷新地址 masterData_.refreshAddr(); modbusmasterchannel form = new modbusmasterchannel(); DeviceData data = masterData_.modbusDeviceList.ElementAt(e.RowIndex); form.getDeviceData(ref data, masterStartAddr_, ref masterData_, ref mastermanage, MID, e.RowIndex); form.devicenumber(data.ID); form.devaddr(dataGridView1.Rows[e.RowIndex].Cells["从站地址"].Value.ToString()); form.devname(dataGridView1.Rows[e.RowIndex].Cells["名称"].Value.ToString()); form.StartPosition = FormStartPosition.CenterScreen; form.ShowDialog(); } } }
private void randomizerSource_SelectedIndexChanged(object sender, EventArgs e) { _dataHasChanged = true; if (inputDataGrid.CurrentCell.ColumnIndex == _randomizerSourceInx) { int selectedIndex = ((ComboBox)sender).SelectedIndex; int rowInx = inputDataGrid.CurrentRow.Index; int colInx = _lookupButtonInx; DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)inputDataGrid.Rows[rowInx].Cells[colInx]; DataGridViewTextBoxCell txtCell = (DataGridViewTextBoxCell)inputDataGrid.Rows[rowInx].Cells[_randomizerFileInx]; if (selectedIndex != _previousRandomizerSourceSelectedIndex[rowInx]) { txtCell.Value = ""; inputDataGrid.CurrentRow.Cells[_randomizerFieldInx].Value = " "; _previousRandomizerSourceSelectedIndex[rowInx] = selectedIndex; } if (selectedIndex != 0) { buttonCell.Enabled = true; } else { buttonCell.Enabled = false; } InitRandomNameFieldDropDown(selectedIndex, rowInx); inputDataGrid.Invalidate(); } }
private void TraerDetalleOC(string _codEmp, int _ordenCompra_id, int _nivel_aut) { try { BLL.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR _detalle = new BLL.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR(); this.dataGridViewDetalle.Rows.Clear(); int indice; foreach (Entities.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR item in _detalle.ItemList(_codEmp, _ordenCompra_id, _nivel_aut)) { indice = dataGridViewDetalle.Rows.Add(); dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.CODIGO].Value = item.articulo_id; //CODIGO PRODUCTO dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.NROITEM].Value = item.nroitem; //NRO ITEM dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.DESCRIPCION].Value = item.art_descgen; //DESCRIPCION PRODUCTO dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.UNIMED].Value = item.unimed; //UNIDAD DE MEDIDA dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.CANT_ORIGINAL].Value = item.cantidad.ToString().Replace(",", "."); //CANTIDAD PEDIDA dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.CANT_ADEUDADA].Value = item.cantidadadeudada.ToString().Replace(",", "."); //CANTIDAD ADEUDADA dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.PORCTOLERANCIA].Value = item.porctoleranciareposicion.ToString().Replace(",", "."); //PORCENTAJE DE TOLERANCIA PARA RECEPCIÓN dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.LLEVA_VENCIMIENTO].Value = item.llevavencimiento; //LLEVA VENCIMIENTO if (Convert.ToBoolean(dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.LLEVA_VENCIMIENTO].Value)) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.VTOS]; //HABILITRO LA CELDA... LE CAMBIO EL VALOR A TRUE buttonCell.Enabled = true; } } labelNumeroFactura.Text = _ordenCompra_id.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 | e.RowIndex < 0) { return; } if (dataGridView1.Columns[e.ColumnIndex].Name == "配置") { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells["配置"]; if (buttonCell.Enabled) { //MessageBox.Show(dataGridView1.Rows[e.RowIndex]. // Cells[e.ColumnIndex].Value.ToString() + // " is enabled"); int a = e.RowIndex; modbusslaveform form = new modbusslaveform(e.RowIndex); int slaveStartAddr = slaveDataManager.getSlaveStartAddr(); ModbusSlaveData data = slaveDataManager.listSlave.ElementAt(e.RowIndex); form.getSlaveData(ref data, slaveStartAddr); form.StartPosition = FormStartPosition.CenterScreen; form.ShowDialog(); } } }
/// <summary> /// 表格中按钮点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSubjective_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { try { if (dgvSubjective.Columns[e.ColumnIndex].Name == "colBtn_1") { if (this.dgvSubjective.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "未修改" && type == "D") //如果规则状态为未修改,而且为医生权限 点击变成已修改 { if (App.ExecuteSQL("update t_deduct_score set state=1 where id='" + dgvSubjective.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'") > 0) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dgvSubjective.Rows[e.RowIndex].Cells[e.ColumnIndex]; buttonCell.Enabled = false; dgvSubjective.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "已修改"; } } else if (this.dgvSubjective.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "已修改" && type != "D")//如果规则状态为已修改,而且为评分权限 点击变成已确认 { if (App.ExecuteSQL("update t_deduct_score set state=2 where id='" + dgvSubjective.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'") > 0) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dgvSubjective.Rows[e.RowIndex].Cells[e.ColumnIndex]; buttonCell.Enabled = false; dgvSubjective.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "已确认"; //删除文书注释、保存文书 save_doc(dgvSubjective.Rows[e.RowIndex].Cells["docId"].Value.ToString(), dgvSubjective.Rows[e.RowIndex].Cells["id"].Value.ToString()); } } } } catch { } } }
public void neonShow(string SID, bool Success) { for (int i = 0; i < TestCaseGridView.RowCount; i++) { if (TestCaseGridView.Rows[i].Cells[1].Value.ToString() == SID) { HeighlightIndex = i; if (i != 0) { beforeButtonCell = this.TestCaseGridView.Rows[i - 1].Cells["EditBtn"] as DataGridViewDisableButtonCell; beforeButtonCell.Enabled = false; TestCaseGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.FromArgb(190, 190, 190); } curButtonCell = this.TestCaseGridView.Rows[i].Cells["EditBtn"] as DataGridViewDisableButtonCell; curButtonCell.Enabled = false; if (Success) { TestCaseGridView.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(130, 206, 111); } else { TestCaseGridView.Rows[i].DefaultCellStyle.BackColor = Color.Red; } } } }
void treeGridViewDifference_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5 && e.RowIndex != -1) { DataGridViewDisableButtonCell cell = treeGridViewDifference.Rows[e.RowIndex].Cells[5] as DataGridViewDisableButtonCell; if (cell.Enabled) { ToolStripDropDown popup = new ToolStripDropDown(); Difference diff = treeGridViewDifference.Rows[e.RowIndex].Tag as Difference; Point location = new Point(treeGridViewDifference.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Left, treeGridViewDifference.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Bottom); popup.Margin = Padding.Empty; popup.Padding = Padding.Empty; ToolStripControlHost host = new ToolStripControlHost(new WebBrowser() { DocumentText = diff.HtmlDiff, Width = cell.ContentBounds.Width * 2 }); host.Margin = Padding.Empty; host.Padding = Padding.Empty; host.AutoSize = false; host.Size = host.Control.Size; popup.Size = host.Size; popup.DropShadowEnabled = true; popup.Items.Add(host); popup.Show(treeGridViewDifference.PointToScreen(location)); } } }
private void SetValue(TreeGridNode node, Difference diff) { if (diff.VR != DicomVRType.SQ) { node.Cells[3].Value = diff.FirstValue; node.Cells[4].Value = diff.SecondValue; } // // If the tag is located in both files we need to find the difference // if (diff.Location == TagLocation.Both && diff.IsChanged()) { if (diff.VR != DicomVRType.SQ) { DataGridViewDisableButtonCell cell = node.Cells[5] as DataGridViewDisableButtonCell; cell.Value = "Show Diff"; } } else { DataGridViewDisableButtonCell cell = node.Cells[5] as DataGridViewDisableButtonCell; cell.Value = string.Empty; if (diff.Location == TagLocation.First) { cell.Style.ForeColor = Color.Red; cell.Value = "Deleted"; } cell.Enabled = false; } }
public override object Clone() { DataGridViewDisableButtonCell cell = (DataGridViewDisableButtonCell)base.Clone(); cell.Enabled = this.Enabled; return(cell); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 | e.RowIndex < 0) { return; } if (dataGridView1.Columns[e.ColumnIndex].Index == (int)COLUMNNAME.CHANNEL) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells[(int)COLUMNNAME.CHANNEL]; if (buttonCell.Enabled) { //MessageBox.Show(dataGridView1.Rows[e.RowIndex]. // Cells[e.ColumnIndex].Value.ToString() + // " is enabled"); modbusmasterchannel form = new modbusmasterchannel(); DeviceData data = data_.modbusDeviceList.ElementAt(e.RowIndex); form.getDeviceData(ref data); form.ShowDialog(); } } }
private void ExcluirButtonEnable(bool blnEnable = false) { foreach (DataGridViewRow row in grdArtigos.Rows) { DataGridViewDisableButtonCell btn = (DataGridViewDisableButtonCell)row.Cells["btnExcluir"]; btn.Enabled = blnEnable; } }
private void dataGridViewDetalle_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == (int)Col_DetalleOC.VTOS && e.RowIndex >= 0) { try { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridViewDetalle.Rows[e.RowIndex].Cells[(int)Col_DetalleOC.VTOS]; if (!buttonCell.Enabled) { MessageBox.Show("Este artículo no tiene el atributo Trabaja con Fecha de Vto.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; //SI EL BUTTON TIENE ENEBLE = FALSE NO PERMITO MOSTRAR EL OTRO FORMULARIO } Frm_Vtos _vto = new Frm_Vtos(); string _art = dataGridViewDetalle.Rows[e.RowIndex].Cells[(int)Col_DetalleOC.CODIGO].Value.ToString(); string _descripArt = dataGridViewDetalle.Rows[e.RowIndex].Cells[(int)Col_DetalleOC.DESCRIPCION].Value.ToString(); //RECUPERO LA LISTA DE VTOS DE ESTE ARTICULO PARA PASARLO AL FORMULARIO DE VTOS List <Entities.Tables.STKVENCIMIENTO> _listObj = _ArtsVtos.FindAll(item => item.ARTICULO_ID == _art); //ACA BORRAR DE LA LISTA ESTE ARTICULO CON TODOS SUS VTOS. PORQUE CARGO TODO DE NUEVO CADA VEZ QUE SE EDITA... //ESTO PORQUE PUEDE ESTAR AGREGANDO O ELIMINANDO VTOS. _ArtsVtos.RemoveAll(item => item.ARTICULO_ID == _art); //PASO LA LISTA AL FORMULARIO DE VTOS _vto.ListVto = _listObj; Entities.Tables.STKVENCIMIENTO _newVto; _vto.CodigoArticuloVto = _art; _vto.DescripArticuloVto = _descripArt; decimal _cantIngresada = 0; int _cantidadFechaVto = 0; if (_vto.ShowDialog() == DialogResult.OK) { foreach (var item in _vto.ListVto) { _newVto = new Entities.Tables.STKVENCIMIENTO(); _newVto.ARTICULO_ID = item.ARTICULO_ID; _newVto.CANTIDAD = item.CANTIDAD; _newVto.VTO = item.VTO; //VOY SUMANDO LAS CANTIDADES _cantIngresada += item.CANTIDAD; _cantidadFechaVto++; //ME DICE CUANTAS FECHAS DE VTOS DISTINTAS TENGO, ES PARA SABER CUANTAS ETIQUETAS DEBO IMPRIMIR _ArtsVtos.Add(_newVto); } //COLOCO LA CANTIDAD TOTAL RECIBIDA DE ESTE ARTICULO dataGridViewDetalle.Rows[e.RowIndex].Cells[(int)Col_DetalleOC.CANT_RECIBIDA].Value = _cantIngresada.ToString().Replace(",", "."); dataGridViewDetalle.Rows[e.RowIndex].Cells[(int)Col_DetalleOC.CANT_ETIQUETAS].Value = _cantidadFechaVto.ToString().Replace(",", "."); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
// style cells private void ButtonCellStyleEnroled(DataGridViewCell cell) { DataGridViewDisableButtonCell btnCell = cell as DataGridViewDisableButtonCell; btnCell.Style = ColumnProperties.btnCellStyle; btnCell.FlatStyle = ColumnProperties.disabledStyle; btnCell.Style.ForeColor = ColumnProperties.disabledColour; btnCell.Enabled = false; cell.ReadOnly = true; }
public void CellLeave(object sender, DataGridViewCellEventArgs e) { var dgv = ((DataGridView)sender); DataGridViewDisableButtonCell removeButtonCell = (DataGridViewDisableButtonCell) (dgv.Rows[e.RowIndex].Cells[RemoveButtonName]); DataGridViewDisableButtonCell editButtonCell = (DataGridViewDisableButtonCell) (dgv.Rows[e.RowIndex].Cells[EditButtonName]); removeButtonCell.Enabled = false; editButtonCell.Enabled = false; dgv.Invalidate(); }
public void AddNewItemAjusteStock(string cod, string descrip, string uniMed, Boolean llevaVto) { this.dataGridViewDetalleAjusteStock.Rows[_indexSeleccionado].Cells[(int)Col_Detalle.CODIGO].Value = cod; this.dataGridViewDetalleAjusteStock.Rows[_indexSeleccionado].Cells[(int)Col_Detalle.DESCRIPCION].Value = descrip; this.dataGridViewDetalleAjusteStock.Rows[_indexSeleccionado].Cells[(int)Col_Detalle.UNIDAD].Value = uniMed; this.dataGridViewDetalleAjusteStock.Rows[_indexSeleccionado].Cells[(int)Col_Detalle.LLEVA_VENCIMIENTO].Value = llevaVto; if (Convert.ToBoolean(dataGridViewDetalleAjusteStock.Rows[_indexSeleccionado].Cells[(int)Col_Detalle.LLEVA_VENCIMIENTO].Value)) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridViewDetalleAjusteStock.Rows[_indexSeleccionado].Cells[(int)Col_Detalle.VTOS]; //HABILITRO LA CELDA... LE CAMBIO EL VALOR A TRUE buttonCell.Enabled = true; } this.dataGridViewDetalleAjusteStock.CurrentCell = this.dataGridViewDetalleAjusteStock.CurrentRow.Cells[(int)Col_Detalle.CANTIDAD]; }
/// <summary> /// 加载查询数据 /// </summary> /// <param name="dataArray"></param> private void LoadQueryData(QueryTrainData[] dataArray) { this.dgvQuery.Rows.Clear(); foreach (QueryTrainData item in dataArray) { if (item.QueryLeftNewDTO != null) { int index = this.dgvQuery.Rows.Add( item.QueryLeftNewDTO.station_train_code, item.QueryLeftNewDTO.from_station_name + "-" + item.QueryLeftNewDTO.to_station_name, item.QueryLeftNewDTO.start_time + "-" + item.QueryLeftNewDTO.arrive_time, item.QueryLeftNewDTO.lishi, item.QueryLeftNewDTO.swz_num, item.QueryLeftNewDTO.tz_num, item.QueryLeftNewDTO.zy_num, item.QueryLeftNewDTO.ze_num, item.QueryLeftNewDTO.gr_num, item.QueryLeftNewDTO.rw_num, item.QueryLeftNewDTO.yw_num, item.QueryLeftNewDTO.rz_num, item.QueryLeftNewDTO.yz_num, item.QueryLeftNewDTO.wz_num, item.QueryLeftNewDTO.qt_num, item.buttonTextInfo); DataGridViewRow row = this.dgvQuery.Rows[index]; for (int i = 4; i < row.Cells.Count; i++) { DataGridViewCell cell = row.Cells[i]; if (cell.Value.ToString() != "*" && cell.Value.ToString() != "--" && cell.Value.ToString() != "无") { cell.Style.ForeColor = Color.Green; } } if (item.QueryLeftNewDTO.canWebBuy == "Y") { DataGridViewDisableButtonCell cell = row.Cells[15] as DataGridViewDisableButtonCell; cell.Enabled = true; } else { DataGridViewDisableButtonCell cell = row.Cells[15] as DataGridViewDisableButtonCell; cell.Enabled = false; } row.Tag = item; } } }
// If a check box cell is clicked, this event handler disables // or enables the button in the same row as the clicked cell. public void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "CheckBoxes") { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells["Buttons"]; DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1. Rows[e.RowIndex].Cells["CheckBoxes"]; buttonCell.Enabled = !(Boolean)checkCell.Value; dataGridView1.Invalidate(); } }
// If the user clicks on an enabled button cell, this event handler // reports that the button is enabled. void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "Buttons") { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells["Buttons"]; if (buttonCell.Enabled) { MessageBox.Show(dataGridView1.Rows[e.RowIndex]. Cells[e.ColumnIndex].Value.ToString() + " is enabled"); } } }
private void TestCaseControlor_CellClick(object sender, DataGridViewCellEventArgs e) { try { string buttonText = this.TestCaseGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].FormattedValue.ToString(); if (buttonText == "Edit" && HeighlightIndex < e.RowIndex) { string SID = this.TestCaseGridView.Rows[e.RowIndex].Cells[1].Value.ToString(); TestCaseGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(213, 233, 99); CaseView.DebugList.Add(SID); curButtonCell = this.TestCaseGridView.Rows[e.RowIndex].Cells["EditBtn"] as DataGridViewDisableButtonCell; curButtonCell.Enabled = false; } } catch { //do nothing } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 | e.RowIndex < 0) { return; } if (dataGridView1.Columns[e.ColumnIndex].Name == "配置") { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells["配置"]; int a = e.RowIndex; if (buttonCell.Enabled) { ModbusServer.modbusserver mss = new modbusserver(e.RowIndex); ModbusServerData data = serverDataManager.listServer.ElementAt(e.RowIndex); data.serverstartaddr = utility.modbusAddr + UserControl1.mci.clientManage.modbusClientList.Count * utility.modbusMudule; mss.getServerData(ref data, data.ID); mss.StartPosition = FormStartPosition.CenterScreen; mss.ShowDialog(); } } if (dataGridView1.Columns[e.ColumnIndex].Name == "info") { int index = dataGridView1.SelectedRows[0].Index; ModbusServerData data = serverDataManager.listServer[0]; dataGridView2.RowCount = 4; dataGridView2.Rows[0].Cells[0].Value = "线圈寄存器"; dataGridView2.Rows[0].Cells[1].Value = data.dataDevice_.coilCount; dataGridView2.Rows[0].Cells[2].Value = data.dataDevice_.coilIoAddrStart; dataGridView2.Rows[1].Cells[0].Value = "保持寄存器"; dataGridView2.Rows[1].Cells[1].Value = data.dataDevice_.holdingCount; dataGridView2.Rows[1].Cells[2].Value = data.dataDevice_.holdingIoAddrStart; dataGridView2.Rows[2].Cells[0].Value = "离散输入寄存器"; dataGridView2.Rows[2].Cells[1].Value = data.dataDevice_.decreteCount; dataGridView2.Rows[2].Cells[2].Value = data.dataDevice_.decreteIoAddrStart; dataGridView2.Rows[3].Cells[0].Value = "状态寄存器"; dataGridView2.Rows[3].Cells[1].Value = data.dataDevice_.statusCount; dataGridView2.Rows[3].Cells[2].Value = data.dataDevice_.statusIoAddrStart; } }
/// <summary> /// 预定 /// </summary> void dgvQuery_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == 15) { DataGridViewDisableButtonCell cell = this.dgvQuery[e.ColumnIndex, e.RowIndex] as DataGridViewDisableButtonCell; if (cell.Enabled) { QueryTrainData data = cell.OwningRow.Tag as QueryTrainData; if (data != null) { this.BookTheTicket(data); } } } } catch (Exception ex) { MessageBox.Show(this, "错误:" + ex.Message, "系统错误"); } return; }
public void CellEnter(object sender, DataGridViewCellEventArgs e) { var dgv = ((DataGridView)sender); DataGridViewDisableButtonCell removeButtonCell = (DataGridViewDisableButtonCell) (dgv.Rows[e.RowIndex].Cells[RemoveButtonName]); DataGridViewDisableButtonCell editButtonCell = (DataGridViewDisableButtonCell) (dgv.Rows[e.RowIndex].Cells[EditButtonName]); removeButtonCell.Enabled = true; editButtonCell.Enabled = true; if (removeButtonCell.Value == null) { removeButtonCell.Value = RemoveButtonName; } if (editButtonCell.Value == null) { editButtonCell.Value = EditButtonName; } dgv.Invalidate(); }
private void inputDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { DataGridViewDisableButtonCell fileLookupCell = (DataGridViewDisableButtonCell)inputDataGrid.Rows[e.RowIndex].Cells[_lookupButtonInx]; DataGridViewComboBoxCell randomizerSourceCell = (DataGridViewComboBoxCell)inputDataGrid.Rows[e.RowIndex].Cells[_randomizerSourceInx]; DataGridViewTextBoxCell randomizerFilePathCell = (DataGridViewTextBoxCell)inputDataGrid.Rows[e.RowIndex].Cells[_randomizerFileInx]; if (fileLookupCell.Enabled) { string cellValue = randomizerSourceCell.Value.ToString(); enRandomDataType randomizerSource = (enRandomDataType)Enum.Parse(typeof(enRandomDataType), cellValue.Replace(" ", "")); string filepath = GetRandomizerFile(randomizerSource); if (filepath.Length > 0) { randomizerFilePathCell.Value = filepath; _dataHasChanged = true; } } } }
private void dataGridViewDetalleIngStock_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { //var senderGrid = (DataGridView)sender; //if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) if (e.ColumnIndex == (int)Col_Detalle.BUSCADOR && e.RowIndex >= 0) { Frm_ProdAjusteStock _prod = new Frm_ProdAjusteStock(); _prod.Articulos = _articulosItem; //le paso la colección de artículos //paso los rubros _prod.Rubros = _rubrositem; _indexSeleccionado = e.RowIndex; //establezco el index _prod.MdiParent = this.MdiParent; // esto porque estoy utiliando MDI _prod.Opener = this; // es para el formulario hijo _prod.Show(); _prod.StartPosition = FormStartPosition.CenterScreen; } if (e.ColumnIndex == (int)Col_Detalle.VTOS && e.RowIndex >= 0) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridViewDetalleAjusteStock.Rows[e.RowIndex].Cells[(int)Col_Detalle.VTOS]; if (!buttonCell.Enabled) { MessageBox.Show("Este artículo no tiene el atributo Trabaja con Fecha de Vto.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; //SI EL BUTTON TIENE ENEBLE = FALSE NO PERMITO MOSTRAR EL OTRO FORMULARIO } Frm_VtosAjuste _vto = new Frm_VtosAjuste(); string _art = dataGridViewDetalleAjusteStock.Rows[e.RowIndex].Cells[(int)Col_Detalle.CODIGO].Value.ToString(); string _descripArt = dataGridViewDetalleAjusteStock.Rows[e.RowIndex].Cells[(int)Col_Detalle.DESCRIPCION].Value.ToString(); //RECUPERO LA LISTA DE VTOS DE ESTE ARTICULO PARA PASARLO AL FORMULARIO DE VTOS List <Entities.Tables.STKVENCIMIENTO> _listObj = _ArtsVtos.FindAll(item => item.ARTICULO_ID == _art); //ACA BORRAR DE LA LISTA ESTE ARTICULO CON TODOS SUS VTOS. PORQUE CARGO TODO DE NUEVO CADA VEZ QUE SE EDITA... //ESTO PORQUE PUEDE ESTAR AGREGANDO O ELIMINANDO VTOS. _ArtsVtos.RemoveAll(item => item.ARTICULO_ID == _art); //PASO LA LISTA AL FORMULARIO DE VTOS _vto.ListVto = _listObj; Entities.Tables.STKVENCIMIENTO _newVto; _vto.CodigoArticuloVto = _art; _vto.DescripArticuloVto = _descripArt; decimal _cantIngresada = 0; int _cantidadFechaVto = 0; if (_vto.ShowDialog() == DialogResult.OK) { foreach (var item in _vto.ListVto) { _newVto = new Entities.Tables.STKVENCIMIENTO(); _newVto.ARTICULO_ID = item.ARTICULO_ID; _newVto.CANTIDAD = item.CANTIDAD; _newVto.VTO = item.VTO; //VOY SUMANDO LAS CANTIDADES _cantIngresada += item.CANTIDAD; _cantidadFechaVto++; //ME DICE CUANTAS FECHAS DE VTOS DISTINTAS TENGO, ES PARA SABER CUANTAS ETIQUETAS DEBO IMPRIMIR _ArtsVtos.Add(_newVto); } //COLOCO LA CANTIDAD TOTAL RECIBIDA DE ESTE ARTICULO //NO COLOCO LA CANTIDAD RECIBIDA PORQUE NO ME HABILITA EL PROXIMO RENGON..... // dataGridViewDetalleIngStock.Rows[e.RowIndex].Cells[(int)Col_Detalle.CANTIDAD].Value = _cantIngresada.ToString().Replace(",", "."); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DataGridViewDisableButtonColumn() { CellTemplate = new DataGridViewDisableButtonCell(); }
/// <summary> /// 主观质控DataGridView数据绑定 /// </summary> private void dgvSubjectiveShow() { try { string strSql = @"select t.id, t.item 评分项目, t.item_score 分值, t.item_content 扣分标准, a.textname 文书类别, a.doc_name 文书名称, a.textkind_id TEXTKIND_ID, t.ITEM_PATIENTID 病人id, isxg, t.medical_mark_id, docId, t.item_type, CASE WHEN STATE IS NULL THEN '未修改' WHEN STATE = 0 THEN '未修改' WHEN STATE = 1 THEN '已修改' else '已确认' end 状态 from t_deduct_score t inner join t_patients_doc a on t.docid=a.tid where t.ITEM_PATIENTID='" + inpat.Id + "' and t.item_type='Y' order by t.state"; DataSet ds = App.GetDataSet(strSql); if (ds != null) { dgvSubjective.DataSource = ds.Tables[0].DefaultView; dgvSubjective.Columns["id"].Visible = false; dgvSubjective.Columns["病人id"].Visible = false; dgvSubjective.Columns["评分项目"].Width = 100; dgvSubjective.Columns["分值"].Width = 50; dgvSubjective.Columns["扣分标准"].Width = 250; dgvSubjective.Columns["medical_mark_id"].Visible = false; dgvSubjective.Columns["item_type"].Visible = false; dgvSubjective.Columns["isxg"].Visible = false; dgvSubjective.Columns["docId"].Visible = false; dgvSubjective.Columns["状态"].Visible = false; dgvSubjective.Columns["文书名称"].Visible = false; dgvSubjective.Columns["TEXTKIND_ID"].Visible = false; DataGridViewDisableButtonColumn btn_1 = new DataGridViewDisableButtonColumn(); btn_1.Name = "colBtn_1"; btn_1.HeaderText = "状态"; btn_1.DataPropertyName = "状态"; dgvSubjective.Columns.Add(btn_1); dgvSubjective.Columns["colBtn_1"].DisplayIndex = 0; if (type == "D")//医生反馈界面,质控状态为未修改显示确认按钮 { for (int i = 0; i < dgvSubjective.Rows.Count; i++) { if (dgvSubjective.Rows[i].Cells["colBtn_1"].Value.ToString() != "未修改") { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dgvSubjective.Rows[i].Cells["colBtn_1"]; buttonCell.Enabled = false; } } } else //质控人接收反馈信息,质控状态为已修改显示确认按钮 { for (int i = 0; i < dgvSubjective.Rows.Count; i++) { if (dgvSubjective.Rows[i].Cells["colBtn_1"].Value.ToString() != "已修改") { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dgvSubjective.Rows[i].Cells["colBtn_1"]; buttonCell.Enabled = false; } } } for (int i = 0; i < dgvSubjective.Columns.Count; i++) { dgvSubjective.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } } } catch { } }
private void SetGridDataView() { _txtCell.Value = "..."; _btnCell.Value = "+++"; inputDataGrid.EditMode = DataGridViewEditMode.EditOnEnter; inputDataGrid.ReadOnly = false; inputDataGrid.ColumnCount = 2; inputDataGrid.Columns[0].Name = "Column Name"; inputDataGrid.Columns[0].ReadOnly = true; inputDataGrid.Columns[1].Name = "Data Type"; inputDataGrid.Columns[1].ReadOnly = true; DataGridViewComboBoxColumn randomizerCombo = new DataGridViewComboBoxColumn(); _randomizerSourceInx = 2; randomizerCombo.HeaderText = "Randomizer Source"; randomizerCombo.Items.AddRange(" ", string.Join(" ", Regex.Split(enRandomDataType.RandomNamesAndLocations.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomDataType.RandomNumbers.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomDataType.RandomWords.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomDataType.RandomDatesAndTimes.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomDataType.RandomBooleans.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomDataType.CustomRandomValues.ToString(), @"(?<!^)(?=[A-Z])")) ); randomizerCombo.DropDownWidth = 250; randomizerCombo.Width = 250; randomizerCombo.MaxDropDownItems = 15; randomizerCombo.ReadOnly = false; inputDataGrid.Columns.Add(randomizerCombo); DataGridViewComboBoxColumn fieldNameCombo = new DataGridViewComboBoxColumn(); _randomizerFieldInx = 3; fieldNameCombo.HeaderText = "Random Name Field"; fieldNameCombo.Items.AddRange(" ", string.Join(" ", Regex.Split(enRandomNameField.NameType.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.Country.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.FirstName.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.MiddleInitial.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.LastName.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.Gender.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.BirthDate.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.AddressLine1.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.AddressLine2.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.City.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.Neighborhood.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.StateProvince.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.ZipPostalCode.ToString(), @"(?<!^)(?=[A-Z])")), string.Join(" ", Regex.Split(enRandomNameField.StateProvinceName.ToString(), @"(?<!^)(?=[A-Z])")) ); fieldNameCombo.DropDownWidth = 250; fieldNameCombo.Width = 250; fieldNameCombo.MaxDropDownItems = 15; fieldNameCombo.ReadOnly = false; inputDataGrid.Columns.Add(fieldNameCombo); DataGridViewTextBoxColumn txtCol = new DataGridViewTextBoxColumn(); int txtInx = inputDataGrid.Columns.Add(txtCol); _randomizerFileInx = txtInx; txtCol.HeaderText = "Randomizer File"; txtCol.Width = 200; txtCol.Name = "txt"; inputDataGrid.Columns[txtInx].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; //DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); DataGridViewDisableButtonColumn btn = new DataGridViewDisableButtonColumn(); int btnInx = inputDataGrid.Columns.Add(btn); _lookupButtonInx = btnInx; btn.HeaderText = "File Lookup"; btn.Text = "..."; btn.DefaultCellStyle.Font = new System.Drawing.Font("Lucida Console", (float)10.0, FontStyle.Bold); btn.Width = 65; btn.Name = "btn"; btn.ReadOnly = true; inputDataGrid.Columns[btnInx].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; btn.UseColumnTextForButtonValue = true; _previousRandomizerSourceSelectedIndex = new int[_colSpecs.Count]; for (int r = 0; r < _colSpecs.Count; r++) { _previousRandomizerSourceSelectedIndex[r] = -1; string randomDataSource = " "; if (_colSpecs[r].RandomDataType != enRandomDataType.NotSpecified) { randomDataSource = string.Join(" ", Regex.Split(_colSpecs[r].RandomDataType.ToString(), @"(?<!^)(?=[A-Z])")); } string[] row; row = new string[] { _colSpecs[r].DataTableColumnName, _colSpecs[r].DataTableColumnDataType.ToString(), randomDataSource, " ", " " }; int rowInx = inputDataGrid.Rows.Add(row); DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)inputDataGrid.Rows[rowInx].Cells[_lookupButtonInx]; buttonCell.Enabled = false; DataGridViewComboBoxCell cboCell = (DataGridViewComboBoxCell)inputDataGrid.Rows[r].Cells[_randomizerFieldInx]; cboCell.Items.Clear(); cboCell.Items.Add(" "); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 | e.RowIndex < 0) { return; } if (dataGridView1.Columns[e.ColumnIndex].Name == columnConfig) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells[columnConfig]; if (buttonCell.Enabled) { //MessageBox.Show(dataGridView1.Rows[e.RowIndex]. // Cells[e.ColumnIndex].Value.ToString() + // " is enabled"); modbusmasterDeviceform form = new modbusmasterDeviceform(); ModbusMasterData data = masterManage.modbusMastrList.ElementAt(e.RowIndex); ModbusMasterManage a = masterManage; int masterStartAddr = masterManage.getMasterStartAddr(); form.getMasterData(ref data, masterStartAddr, a, e.RowIndex); form.StartPosition = FormStartPosition.CenterScreen; form.ShowDialog(); } } else if (dataGridView1.Columns[e.ColumnIndex].Name == columnDetail) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells[columnConfig]; if (buttonCell.Enabled) { var modbusDeviceList = masterManage.modbusMastrList[e.RowIndex].modbusDeviceList; var count = 0; dataGridView2.Rows.Clear(); for (int i = 0; i < modbusDeviceList.Count; i++) { count += modbusDeviceList[i].modbusChannelList.Count; } dataGridView2.RowCount += count; //dataGridView2.AutoSize = true; //dataGridView2.AllowUserToAddRows = false; //dataGridView2.ColumnHeadersDefaultCellStyle.Alignment = // DataGridViewContentAlignment.MiddleCenter; int j = 0; foreach (var device in modbusDeviceList) { string deviceName = device.nameDev; foreach (var channel in device.modbusChannelList) { string channelName = channel.nameChannel; dataGridView2.Rows[j].Cells["设备名"].Value = deviceName; dataGridView2.Rows[j].Cells["通道名"].Value = channelName; dataGridView2.Rows[j].Cells["功能码"].Value = dicMsg[channel.msgType]; dataGridView2.Rows[j].Cells["通道起始地址"].Value = channel.curChannelAddr + 3; dataGridView2.Rows[j].Cells["长度"].Value = channel.readLength; dataGridView2.Rows[j].Cells["触发变量地址"].Value = channel.writeOffset; dataGridView2.Rows[j].Cells["错误变量地址"].Value = channel.writeLength; j++; } } } } }