private void GenerateWindows(int limit) { if (listValues.Count == 0) { #if true foreach (System.Windows.Controls.ListBoxItem item in R.Items) { NamedSolidColorBrush nscb = new NamedSolidColorBrush(item); listKeys.Add(nscb.Kanji); listValues.Add(nscb); DoEvents(); } #else foreach (KeyValuePair <string, NamedSolidColorBrush> Core in Jc.Cores) { listKeys.Add(Core.Key); listValues.Add(Core.Value); } #endif } for (int i = 0; i < limit; ++i) { if (ColorIndex >= listValues.Count) { ColorIndex = 0; } string jname = listKeys[ColorIndex]; string title = String.Format("Child-Color#{0:000}-{1}", ColorIndex, jname); Child f = new Child(this, title, new KeyValuePair <string, NamedSolidColorBrush>(jname, listValues[ColorIndex])); f.Show(); forms.Add(title, f); ++ColorIndex; DoEvents(); } }
private object SetListBoxItem(NamedSolidColorBrush nscb) { ListBoxItem item = new ListBoxItem(); item.HorizontalContentAlignment = HorizontalAlignment.Stretch; item.Content = plateOf(nscb); item.ToolTip = swatchOf(nscb); return(item); }
private void L_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox lb = sender as ListBox; if (lb.SelectedIndex < 0) { return; } fillColors(); if (!inclusive) { Nscbs.Clear(); } foreach (ListBoxItem item in e.AddedItems) { TextBlock tb = item.Content as TextBlock; if (tb != null) { if (tb.Text.Contains("全て")) { ClearList(); return; } foreach (ListBoxItem ritem in R.Items) { if (ritem == null) { continue; } UniformGrid ug = ritem.Content as UniformGrid; TextBlock yomi = ug.Children[1] as TextBlock; if (yomi.Text.StartsWith(tb.Text)) { NamedSolidColorBrush nscb = new NamedSolidColorBrush(ritem); if (!Nscbs.Contains(nscb)) { Nscbs.Add(nscb); } } } } } R.Items.Clear(); foreach (NamedSolidColorBrush nscb in Nscbs) { R.Items.Add(SetListBoxItem(nscb)); } updateTitle(); e.Handled = true; }
private void InvertClicked(CheckBox cb) { CMYK.Invert = NamedSolidColorBrush.Invert = cb.IsChecked.Value; List <NamedSolidColorBrush> nscbs = new List <NamedSolidColorBrush>(); foreach (ListBoxItem item in R.Items) { NamedSolidColorBrush nscb = new NamedSolidColorBrush(item); nscbs.Add(nscb); } nscbs.Sort(); R.Items.Clear(); foreach (NamedSolidColorBrush nscb in nscbs) { R.Items.Add(SetListBoxItem(nscb)); } }
private void RadioButton_Checked(object sender, RoutedEventArgs e) { RadioButton rb = sender as RadioButton; if (AnyOfGroupMembers(rb)) { string name = (string)rb.Content; if (name.StartsWith("~")) { name = name.Replace("~", "n"); } NamedSolidColorBrush.howCompare = (NamedSolidColorBrush.HowCompare)Enum.Parse(typeof(NamedSolidColorBrush.HowCompare), name); List <NamedSolidColorBrush> nscbs = new List <NamedSolidColorBrush>(); foreach (ListBoxItem item in R.Items) { NamedSolidColorBrush nscb = new NamedSolidColorBrush(item); if (!nscbs.Contains(nscb)) { nscbs.Add(nscb); } } nscbs.Sort(); R.Items.Clear(); foreach (NamedSolidColorBrush nscb in nscbs) { R.Items.Add(SetListBoxItem(nscb)); } return; } L.SelectionMode = (SelectionMode)Enum.Parse(typeof(SelectionMode), (string)rb.Content); if (lastMode != L.SelectionMode) { fillColors(); lastMode = L.SelectionMode; } SetLListBrush(rb); ClearListL(); }
private UIElement plateOf(NamedSolidColorBrush nscb) { return(plateOf(nscb.Kanji, nscb.Yomi, nscb.Brush)); }
private UIElement swatchOf(NamedSolidColorBrush nscb) { return(swatchOf(nscb.Kanji, nscb)); }
protected virtual Panel swatchOf(string kanji, NamedSolidColorBrush nscb) { return(swatchOf(NamedSolidColorBrush.Show(kanji, nscb.Brush, nscb.Names), nscb.Brush)); }