public FillProps(Draws drw) { //Thread.CurrentThread.CurrentUICulture = new CultureInfo("en"); InitializeComponent(); // ------------------------------------------------------------------- cbColor.Items.Clear(); cbColor.Items.AddRange(DrawUtils.GetAllColorNames()); // получение всех имён доступных цветов cbColor.Items.Add("Выбор цвета..."); // добавление пункта выбора цвета cbColor.Text = DrawUtils.GetColorNameFromIndex(LastColorIndex); // ------------------------------------------------------------------- cbColorPattern.Items.Clear(); cbColorPattern.Items.AddRange(DrawUtils.GetAllColorNames()); // получение всех имён доступных цветов cbColorPattern.Items.Add("Выбор цвета..."); // добавление пункта выбора цвета cbColorPattern.Text = DrawUtils.GetColorNameFromIndex(LastPatternColorIndex); // ------------------------------------------------------------------- cbPattern.Items.Clear(); cbPattern.Items.AddRange(DrawUtils.GetAllPatternNames()); // получение всех имён доступных паттернов cbPattern.SelectedIndex = 1; // ------------------------------------------------------------------- if (drw != null) { fill.Assign(drw.Fill); } // ------------------------------- int Index = DrawUtils.ColorToIndex(fill.Color); if (Index < 0) { DrawUtils.AddCustomColor(fill.Color); cbColor.Items.Insert(cbColor.Items.Count - 1, "Мой цвет"); Index = cbColor.Items.Count - 2; } if (Index >= 0) { cbColor.SelectedIndex = Index; } // ------------------------------- Index = DrawUtils.ColorToIndex(fill.PatternColor); if (Index < 0) { DrawUtils.AddCustomColor(fill.PatternColor); cbColorPattern.Items.Insert(cbColorPattern.Items.Count - 1, "Мой цвет"); Index = cbColorPattern.Items.Count - 2; } if (Index >= 0) { cbColorPattern.SelectedIndex = Index; } // ------------------------------- tbTrasparent.Value = 255 - fill.Alpha; lbTrasparent.Text = String.Format(CultureInfo.InvariantCulture, "{0}", (int)(tbTrasparent.Value / 255.0 * 100.0)) + " %"; // ------------------------------- cbPattern.SelectedIndex = fill.PatternIndex; cbColorPattern.Enabled = (cbPattern.SelectedIndex > 1); }