private void MvFrm_Load(object sender, EventArgs e) { Inicializar(); switch (_controlador.EnumTipoMovimiento) { case enumerados.enumTipoMovimiento.Cargo: P_TIPO_MOVIMIENTO.BackColor = Color.Green; break; case enumerados.enumTipoMovimiento.Descargo: P_TIPO_MOVIMIENTO.BackColor = Color.Red; break; case enumerados.enumTipoMovimiento.Traslado: case enumerados.enumTipoMovimiento.Ajuste: P_TIPO_MOVIMIENTO.BackColor = Color.Orange; break; } DTP_FECHA.Focus(); L_TIPO_MOVIMIENTO.Text = _controlador.TipoMovimiento; L_MONTO.Text = _controlador.MontoMovimiento.ToString("n2"); L_ITEMS.Text = _controlador.ItemsMovimiento; CB_DEP_DESTINO.Enabled = _controlador.Habilitar_DepDestino; DGV_DETALLE.Columns["TipoMov"].Visible = _controlador.VisualizarColumnaTipoMovimiento; DGV_DETALLE.DataSource = _controlador.DetalleSouce; DGV_DETALLE.Refresh(); CB_CONCEPTO.Enabled = _controlador.HabilitarConcepto; }
private void Agregar_Load(object sender, EventArgs e) { DTP_FECHA.Select(); L_NUMERO.Text = ""; L_DIF_DEBE.Text = ""; L_DIF_HABER.Text = ""; // DGV.CellLeave += DGV_CellLeave; DGV.CellValidating += DGV_CellValidating; DGV.CellEndEdit += DGV_CellEndEdit; DGV.CellEnter += DGV_CellEnter; DGV.CellBeginEdit += DGV_CellBeginEdit; DGV.CellPainting += DGV_CellPainting; DGV.CellValueChanged += DGV_CellValueChanged; DGV.RowValidating += DGV_RowValidating; DGV.KeyDown += DGV_KeyDown; DGV.AutoGenerateColumns = false; DGV.AllowUserToAddRows = false; DGV.AllowUserToDeleteRows = false; DGV.ReadOnly = false; var f2 = new Font("Serif", 10, FontStyle.Bold); var c1 = new DataGridViewTextBoxColumn(); c1.DataPropertyName = "Codigo"; c1.HeaderText = "Código"; c1.Name = "codigo"; c1.Visible = true; c1.ReadOnly = false; c1.Width = 140; c1.DefaultCellStyle.Font = f2; var c2 = new DataGridViewTextBoxColumn(); c2.DataPropertyName = "Descripcion"; c2.HeaderText = "Descripción"; c2.Name = "descripcion"; c2.Visible = true; c2.ReadOnly = false; c2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; var c3 = new DataGridViewTextBoxColumn(); c3.DefaultCellStyle.BackColor = Color.Blue; c3.DataPropertyName = "Debe"; c3.HeaderText = "Debe"; c3.Name = "debe"; c3.Visible = true; c3.Width = 150; c3.ReadOnly = false; c3.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight; c3.DefaultCellStyle.ForeColor = Color.White; c3.DefaultCellStyle.Font = f2; c3.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; c3.DefaultCellStyle.Format = "n2"; var c4 = new DataGridViewTextBoxColumn(); c4.DefaultCellStyle.BackColor = Color.Red; c4.DataPropertyName = "Haber"; c4.HeaderText = "Haber"; c4.Name = "haber"; c4.Visible = true; c4.Width = 150; c4.ReadOnly = false; c4.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight; c4.DefaultCellStyle.ForeColor = Color.White; c4.DefaultCellStyle.Font = f2; c4.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; c4.DefaultCellStyle.Format = "n2"; DGV.Columns.Add(c1); DGV.Columns.Add(c2); DGV.Columns.Add(c3); DGV.Columns.Add(c4); bs = new BindingSource(); items = new BindingList<Detalle>(); items.ListChanged += items_ListChanged; bs.DataSource = items; DGV.DataSource = bs; // if (ModoFicha== Modo.AgregarFicha) { CargarData(); var it = new Detalle(); items.Add(it); } else if (ModoFicha == Modo.EditarFicha) { L_MODO_FICHA.Visible = true; CargarDataAsiento(IdAsientoEditarExportar); } else { CargarDataExportar(IdAsientoEditarExportar); } }