private void btnBrowseColor_Click(object sender, EventArgs e) { using (DialogColor colorPicker = new DialogColor()) { if (!string.IsNullOrEmpty(txtColor.Text)) { colorPicker.SetCurrentColor(MyColors.ParseColor(txtColor.Text)); } if (colorPicker.ShowDialog() == DialogResult.OK) { Color color = colorPicker.Color; txtColor.Text = string.Format("{0},{1},{2},{3}", color.A, color.R, color.G, color.B); } } }
public GradientStop(string color, string offset) { this.Color = MyColors.ParseColor(color); if (this.Color == null) { throw new Exception("Color is unknown."); } float offset2; if (float.TryParse(offset, NumberStyles.Any, CultureInfo.InvariantCulture, out offset2)) { this.Offset = offset2; } else { this.Offset = 0; } }