private void dgvBookings_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { var ServiceCodeCel = dgvBookings.Rows[e.RowIndex].Cells["ServiceCode"]; var BookingNumberCel = dgvBookings.Rows[e.RowIndex].Cells["MinibookingNumber"]; var checkCell = dgvBookings.Rows[e.RowIndex].Cells["check"]; var cans = dgvBookings.Rows[e.RowIndex].Cells["NumberOfContainer"]; checkCell.Style.Font = new Font("Arial", 15.5f, FontStyle.Bold); checkCell.Style.ForeColor = Color.Black; checkCell.Style.SelectionForeColor = Color.Black; if (MdlBookingManagement.IsOdd(e.RowIndex)) { checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control); } else { checkCell.Style.SelectionBackColor = Color.White; } checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; if (Information.IsNothing(checkCell.Value)) { checkCell.Value = "✔"; } BookingNumberCel.Style.Font = new Font("Arial", 10f, FontStyle.Bold); BookingNumberCel.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; cans.Style.Font = new Font("Arial", 10f, FontStyle.Bold); cans.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; ServiceCodeCel.Style.ForeColor = Color.White; ServiceCodeCel.Style.SelectionForeColor = Color.White; ServiceCodeCel.Style.Font = new Font("Arial", 10f, FontStyle.Bold); ServiceCodeCel.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; // REPO Color.Thistle // EXPORT Color.PowderBlue switch (ServiceCodeCel.Value) { case "BAG": { ServiceCodeCel.Style.SelectionBackColor = Color.Olive; ServiceCodeCel.Style.BackColor = Color.DarkKhaki; break; } case "BGR": { ServiceCodeCel.Style.SelectionBackColor = Color.DarkGoldenrod; ServiceCodeCel.Style.BackColor = Color.Goldenrod; break; } case "BLK": { ServiceCodeCel.Style.SelectionBackColor = Color.DarkKhaki; ServiceCodeCel.Style.BackColor = Color.DarkSeaGreen; break; } } }
private void dgvVessel_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { var checkCell = dgvVessel.Rows[e.RowIndex].Cells["check"]; checkCell.Style.Font = new Font("Arial", 15.5f, FontStyle.Bold); checkCell.Style.ForeColor = Color.Black; checkCell.Style.SelectionForeColor = Color.Black; if (MdlBookingManagement.IsOdd(e.RowIndex)) { checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control); } else { checkCell.Style.SelectionBackColor = Color.White; } checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; if (Information.IsNothing(checkCell.Value)) { checkCell.Value = " "; } }
private void dgvReleaseDistribution_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { if (inboutTabs.SelectedIndex == 1) { var DateRequested = dgvReleaseDistribution.Rows[e.RowIndex].Cells["DataGridViewTextBoxColumn17"]; var checkCell = dgvReleaseDistribution.Rows[e.RowIndex].Cells["checkDist"]; var cansRequested = dgvReleaseDistribution.Rows[e.RowIndex].Cells["QtyRequestedDataGridViewTextBoxColumn4"]; var cansAccepted = dgvReleaseDistribution.Rows[e.RowIndex].Cells["TotalAcceptedOfRequestDataGridViewTextBoxColumn"]; var StatusName = dgvReleaseDistribution.Rows[e.RowIndex].Cells["StatusNameDataGridViewTextBoxColumn2"]; var relNumber = dgvReleaseDistribution.Rows[e.RowIndex].Cells["ReleaseNumberDataGridViewTextBoxColumn2"]; var carrier = dgvReleaseDistribution.Rows[e.RowIndex].Cells["DataGridViewTextBoxColumn18"]; DataGridViewImageCell msgImg = (DataGridViewImageCell)dgvReleaseDistribution.Rows[e.RowIndex].Cells["MessageColumn"]; var msg = dgvReleaseDistribution.Rows[e.RowIndex].Cells["msg"]; checkCell.Style.Font = new Font("Arial", 15.5f, FontStyle.Bold); checkCell.Style.ForeColor = Color.Black; checkCell.Style.SelectionForeColor = Color.Black; if (MdlBookingManagement.IsOdd(e.RowIndex)) { checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control); } else { checkCell.Style.SelectionBackColor = Color.White; } checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; if (Information.IsNothing(checkCell.Value)) { checkCell.Value = " "; } // dgvRequests.Columns(8).Height = 25 DateRequested.Style.Font = new Font("Arial", 10f, FontStyle.Bold); DateRequested.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; carrier.Style.Font = new Font("Arial", 10f, FontStyle.Bold); carrier.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; cansRequested.Style.Font = new Font("Arial", 11f, FontStyle.Bold); cansRequested.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; cansAccepted.Style.Font = new Font("Arial", 11f, FontStyle.Bold); cansAccepted.Style.ForeColor = Color.DarkGreen; cansAccepted.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; StatusName.Style.ForeColor = Color.White; StatusName.Style.SelectionForeColor = Color.White; StatusName.Style.Font = new Font("Bahnschrift", 9f, FontStyle.Bold); StatusName.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; int width = dgvReleaseDistribution.Columns["MessageColumn"].Width; int heght = dgvReleaseDistribution.Rows[e.RowIndex].Height; // msgImg.Style.BackColor = Color.White // msgImg.Style.SelectionBackColor = Color.White msgImg.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; msgImg.Style.SelectionBackColor = Color.FromArgb(64, 64, 64); msgImg.Style.BackColor = Color.FromArgb(64, 64, 64); switch (msg.Value) { case "New Message": { msgImg.Value = newImgMsg; break; } case "Old Message": { msgImg.Value = oldImgMsg; break; } default: { msgImg.Value = noImgMsg; break; } } switch (StatusName.Value) { case "ACCEPTED": { StatusName.Style.SelectionBackColor = Color.DarkGreen; StatusName.Style.BackColor = Color.Green; break; } case "PENDING REPLY": { StatusName.Style.SelectionBackColor = Color.DarkGoldenrod; StatusName.Style.BackColor = Color.Goldenrod; break; } case "DECLINED": { StatusName.Style.SelectionBackColor = Color.DarkRed; StatusName.Style.BackColor = Color.Red; break; } case "FOLLOW UP": { StatusName.Style.SelectionBackColor = Color.DarkOrange; StatusName.Style.BackColor = Color.Orange; break; } case "PARTIALLY ACCEPTED": { StatusName.Style.SelectionBackColor = Color.DarkOliveGreen; StatusName.Style.BackColor = Color.DarkOliveGreen; break; } } } }
private void dgvRequests_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { if (inboutTabs.SelectedIndex == 0) { var DateRequested = dgvRequests.Rows[e.RowIndex].Cells["DateRequestedDataGridViewTextBoxColumn2"]; var checkCell = dgvRequests.Rows[e.RowIndex].Cells["check"]; var cansRequested = dgvRequests.Rows[e.RowIndex].Cells["QtyRequestedDataGridViewTextBoxColumn3"]; var cansAccepted = dgvRequests.Rows[e.RowIndex].Cells["TotalQtyAccptOfRequest"]; var StatusName = dgvRequests.Rows[e.RowIndex].Cells["StatusNameDataGridViewTextBoxColumn3"]; DataGridViewButtonCell BtnAction = (DataGridViewButtonCell)dgvRequests.Rows[e.RowIndex].Cells["btnReqAction"]; checkCell.Style.Font = new Font("Arial", 15.5f, FontStyle.Bold); checkCell.Style.ForeColor = Color.Black; checkCell.Style.SelectionForeColor = Color.Black; if (MdlBookingManagement.IsOdd(e.RowIndex)) { checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control); } else { checkCell.Style.SelectionBackColor = Color.White; } checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; if (Information.IsNothing(checkCell.Value)) { checkCell.Value = " "; } BtnAction.Style.Font = new Font("Arial Narrow", 8.5f, FontStyle.Bold); BtnAction.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; BtnAction.Style.SelectionForeColor = Color.White; BtnAction.Style.ForeColor = Color.White; // dgvRequests.Columns(8).Height = 25 DateRequested.Style.Font = new Font("Arial", 10f, FontStyle.Bold); DateRequested.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; cansRequested.Style.Font = new Font("Arial", 11f, FontStyle.Bold); cansRequested.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; cansAccepted.Style.Font = new Font("Arial", 11f, FontStyle.Bold); cansAccepted.Style.ForeColor = Color.DarkGreen; cansAccepted.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; StatusName.Style.ForeColor = Color.White; StatusName.Style.SelectionForeColor = Color.White; StatusName.Style.Font = new Font("Bahnschrift", 9f, FontStyle.Bold); StatusName.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; BtnAction.Value = "UPDATE STATUS"; BtnAction.Style.BackColor = Color.OliveDrab; BtnAction.Style.SelectionBackColor = Color.OliveDrab; switch (StatusName.Value) { case "ACCEPTED": { StatusName.Style.SelectionBackColor = Color.DarkGreen; StatusName.Style.BackColor = Color.Green; break; } case "PENDING REPLY": { StatusName.Style.SelectionBackColor = Color.DarkGoldenrod; StatusName.Style.BackColor = Color.Goldenrod; break; } case "DECLINED": { StatusName.Style.SelectionBackColor = Color.DarkRed; StatusName.Style.BackColor = Color.Red; // case "FOLLOW UP" break; } default: { // StatusName.Style.Font = New Font("Arial", 10, FontStyle.Bold) if (StatusName.Value.ToString().Contains("TODAY") | StatusName.Value.ToString().Contains("LATE")) { if (StatusName.Value.ToString().Contains("LATE")) { // StatusName.Style.Font = New Font("Arial", 8, FontStyle.Bold) StatusName.Style.BackColor = Color.Red; } else { StatusName.Style.SelectionBackColor = Color.Maroon; StatusName.Style.BackColor = Color.OrangeRed; } } else { StatusName.Style.SelectionBackColor = Color.DarkOrange; StatusName.Style.BackColor = Color.Orange; } break; } } } }