private void typeDoubleInput_Leave(object sender, EventArgs e) { BookTypeModel type = BookTypeController.GetBookType( ((int)typeDoubleInput.Value) / 100 * 100); typeLabel.BackColor = type.Colour; }
private void okButton_Click(object sender, EventArgs e) { TypeName = nameTextBox.Text; BookTypeModel bookType = new BookTypeModel() { Name = TypeName, Colour = Colour }; BookTypeController.EditBookType(TypeNo, bookType); }
private void loadTable() { DataTable table = BookTypeController.GetBookType(); if (table == null) { return; } foreach (DataRow row in table.Rows) { int?colour = row[2] as int?; dataGridView.Rows.Add(row[0], row[1], ""); //Set colour int count = dataGridView.Rows.Count; if (colour != null) { dataGridView.Rows[count - 1].Cells[2].Style.BackColor = Color.FromArgb((int)colour); } dataGridView.Refresh(); } }