static public void PaintTag(RedListCategoryEnum _categ, Graphics _graphics, Rectangle R, Font _font) { StringFormat centeredText = new StringFormat() { LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center }; _graphics.FillRectangle(GetBackBrush(_categ), R); _graphics.DrawString(GetAbbreviation(_categ), _font, GetForeBrush(_categ), R, centeredText); }
static public Brush GetForeBrush(RedListCategoryEnum _category) { if (_category >= RedListCategoryEnum.ExtinctInTheWild) { return(Brushes.White); } else { return(Brushes.Black); } }
private void addButton_Click(object sender, EventArgs e) { if (classicRankCB.Text == string.Empty) { errorLabel.Text = "Please select a classic rank value"; return; } if (RedListCategory.Text == string.Empty) { errorLabel.Text = "Please select a red list category"; return; } string nameString = nameTextBox.Text; if (nameString == string.Empty) { nameString = "Unnamed"; } Helpers.MultiName name = new Helpers.MultiName(nameString); Helpers.MultiName frenchName = new Helpers.MultiName(frenchNameTextBox.Text); ClassicRankEnum classicRank = ClassicRankEnum.None; Enum.TryParse <ClassicRankEnum>(classicRankCB.Text, out classicRank); RedListCategoryEnum redListCategory = RedListCategoryEnum.NotEvaluated; Enum.TryParse <RedListCategoryEnum>(RedListCategoryCB.Text, out redListCategory); TaxonDesc desc = new TaxonDesc { RefMultiName = name, ClassicRank = classicRank, RedListCategory = redListCategory, FrenchMultiName = frenchName }; node = new TaxonTreeNode { Desc = desc }; Close(); }
static public void SetupToggleButton(RedListCategoryEnum _categ, System.Windows.Forms.CheckBox _cb) { _cb.Tag = _categ; _cb.Text = _Abbreviations[(int)_categ]; _cb.BackColor = Color.Transparent; _cb.FlatAppearance.CheckedBackColor = _Colors[(int)_categ]; _cb.FlatAppearance.MouseDownBackColor = _Colors[(int)_categ]; if (_cb.Checked) { if (_categ >= RedListCategoryEnum.ExtinctInTheWild) { _cb.ForeColor = Color.White; } else { _cb.ForeColor = Color.Black; } } else { _cb.ForeColor = Color.DimGray; } }
static public Brush GetBackBrush(RedListCategoryEnum _category) { return(_Brushes[(int)_category]); }
static public string GetName(RedListCategoryEnum _category) { return(_Names[(int)_category]); }
static public string GetAbbreviation(RedListCategoryEnum _category) { return(_Abbreviations[(int)_category]); }