internal CustomListBoxTextEditor(CustomListBox listBox, TextBox textBox) { _listBox = listBox; _textBox = textBox; _textBox.Validating += OnValidating; _textBox.KeyDown += OnKeyDown; }
private void UncheckAllCustom_Click(object sender, EventArgs e) { for (int cnt = 0; cnt < CustomListBox.Items.Count; cnt++) { CustomListBox.SetItemChecked(cnt, false); } }
private void CustomGenerate_Click(object sender, EventArgs e) { CustomResault.ForeColor = Color.Black; int cnt = 0; for (int i = 0; i <= (CustomListBox.Items.Count - 1); i++) { if (CustomListBox.GetItemChecked(i)) { cnt = (i + 1); } } if (cnt >= 2) { for (i = 0; i <= (CustomListBox.Items.Count - 1); i++) { if (CustomListBox.GetItemChecked(i)) { CustomList.Add(CustomListBox.Items[i].ToString()); } } result = Convert.ToString((string)CustomList[random.Next(0, CustomList.Count)]); Timer4Custom.Start(); } else { MessageBox.Show("2つ以上の登録が必要", "Error"); } }
/// <summary> /// Create the popup's content /// </summary> /// <returns>The control to add to the popup</returns> protected override Control CreateContent() { CustomListBox tempListBox = null; try { tempListBox = new CustomListBox(); tempListBox.DropDownMouseMove += listBox_DropDownMouseMove; tempListBox.SelectedIndexChanged += listBox_SelectedIndexChanged; tempListBox.BorderStyle = BorderStyle.None; tempListBox.Dock = DockStyle.Fill; tempListBox.FormattingEnabled = true; tempListBox.Location = new Point(0, 0); tempListBox.Name = "listBox"; tempListBox.Size = new Size(47, 15); tempListBox.TabIndex = 0; m_listBox = tempListBox; tempListBox = null; } finally { tempListBox?.Dispose(); } return(m_listBox); }
public BuildTypeBuildsView(IWorkingEnvironment environment) : base(Guids.BuildTypeBuildsViewGuid, environment) { _lstBuilds = new CustomListBox(); _lstBuilds.BorderStyle = System.Windows.Forms.BorderStyle.None; _lstBuilds.Columns.AddRange(new CustomListBoxColumn[] { new CustomListBoxColumn((int)ColumnId.Id, Resources.StrId) { Width = 50 }, new CustomListBoxColumn((int)ColumnId.Number, Resources.StrNumber) { Width = 150 }, new DateColumn((int)ColumnId.StartDate, Resources.StrStartDate, true) { Width = 150 }, new CustomListBoxColumn((int)ColumnId.Status, Resources.StrStatus) { Width = 100 }, }); _lstBuilds.Bounds = this.ClientRectangle; _lstBuilds.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom; _lstBuilds.Parent = this; }
/// <summary>Create <see cref="ColumnsDialog"/>.</summary> /// <param name="listBox">Related <see cref="CustomListBox"/>.</param> public ColumnsDialog(CustomListBox listBox) { Verify.Argument.IsNotNull(listBox, nameof(listBox)); ListBox = listBox; InitializeComponent(); Text = Resources.StrColumns; _lblVisibleColumns.Text = Resources.StrVisibleColumns.AddColon(); _btnUp.Text = Resources.StrUp; _btnDown.Text = Resources.StrDown; _btnShow.Text = Resources.StrShow; _btnHide.Text = Resources.StrHide; _lstColumns.BeginUpdate(); _lstColumns.Style = GitterApplication.DefaultStyle; _lstColumns.HeaderStyle = HeaderStyle.Hidden; _lstColumns.Columns.Add(new CustomListBoxColumn(0, string.Empty, true) { SizeMode = ColumnSizeMode.Fill }); foreach (var c in ListBox.Columns) { _lstColumns.Items.Add(new ColumnItem(c)); } _lstColumns.EndUpdate(); }
public void CustomListBoxNotAdjustedItemTypeTest() { var containter = new CustomListBoxItem() { DataContext = itemViewModel1 }; containter.Content = originalSource; var itemsControl = new CustomListBox(); itemsControl.Items.Add(containter); var result = converter.TestConvert(itemsControl, originalSource); Assert.IsNull(result); }
private void InitializeControls() { removeSpellButton = new StandardButton(25) { Position = new Point(Width - 57, 16), Text = "[R] Remove from Library" }; removeSpellButton.Click += (sender, args) => RemoveSpell?.Invoke(this, EventArgs.Empty); Add(removeSpellButton); editSpellButton = new StandardButton(25) { Position = new Point(Width - 57, 13), Text = "[E] Edit Spell" }; editSpellButton.Click += (sender, args) => EditSpell?.Invoke(this, EventArgs.Empty); Add(editSpellButton); spellDetails = new SpellDetailsControl(57, Height - 10) { Position = new Point(Width - 58, 3) }; Add(spellDetails); var scrollBarTheme = new ScrollBarTheme { Normal = new Cell(DefaultForeground, DefaultBackground) }; var scrollBar = new ScrollBar(Orientation.Vertical, Height - 6) { Position = new Point(Width - 60, 5), Theme = scrollBarTheme }; Add(scrollBar); spellsList = new CustomListBox <SpellListBoxItem>(Width - 61, Height - 6, scrollBar) { Position = new Point(1, 5) }; spellsList.SelectionChanged += spellsListBox_SelectedItemChanged; Add(spellsList); var textBoxTheme = new TextBoxTheme { Normal = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)), Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)) }; filterTextBox = new TextBox(Width - 69) { Position = new Point(10, 3), Theme = textBoxTheme, MaxLength = Width - 70 }; Add(filterTextBox); UpdateSpellDetails(); }
public void CustomListBoxAdjustedItemTypeTest() { converter.ItemType = typeof(CustomListBoxItem); var containter = new CustomListBoxItem() { DataContext = itemViewModel1 }; containter.Content = originalSource; var itemsControl = new CustomListBox(); itemsControl.Items.Add(containter); var result = converter.TestConvert(itemsControl, originalSource); Assert.AreEqual(itemViewModel1, result); }
public static void OnSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CustomListBox clb = d as CustomListBox; var selectedItems = e.NewValue as ObservableCollection <MyItem>; if (selectedItems != null) { clb.SetSelectedItems(selectedItems); } }
private void DeleteCustom_Click(object sender, EventArgs e) { for (i = 0; i <= (CustomListBox.Items.Count - 1); i++) { if (CustomListBox.GetItemChecked(i)) { RemoveCustomRecord(CustomListBox.Items[i].ToString()); } } RefreshCustomList(); }
/// <summary> /// Create the popup's content /// </summary> /// <returns>The control to add to the popup</returns> protected override Control CreateContent() { m_listBox = new CustomListBox(); m_listBox.BorderStyle = System.Windows.Forms.BorderStyle.None; m_listBox.Dock = System.Windows.Forms.DockStyle.Fill; m_listBox.FormattingEnabled = true; m_listBox.Location = new System.Drawing.Point(0, 0); m_listBox.Name = "m_listBox"; m_listBox.Size = new System.Drawing.Size(47, 15); m_listBox.TabIndex = 0; return(m_listBox); }
public void CustomListBoxNotAdjustedItemTypeTest() { var containter = new CustomListBoxItem() { DataContext = itemViewModel1 }; containter.Content = originalSource; var itemsControl = new CustomListBox(); itemsControl.Items.Add(containter); ShowControl(itemsControl); var result = converter.TestConvert(itemsControl, originalSource); Assert.IsNull(result); Assert.AreEqual(null, ItemsControlMouseEventArgsConverter.GetDataRow(itemsControl, CreateMouseArgs())); }
/// <summary> /// Create the popup's content /// </summary> /// <returns>The control to add to the popup</returns> protected override Control CreateContent() { CustomListBox tempListBox = null; try { tempListBox = new CustomListBox(); tempListBox.DropDownMouseMove += listBox_DropDownMouseMove; tempListBox.SelectedIndexChanged += listBox_SelectedIndexChanged; tempListBox.BorderStyle = BorderStyle.None; tempListBox.Dock = DockStyle.Fill; tempListBox.FormattingEnabled = true; tempListBox.Location = new Point(0, 0); tempListBox.Name = "listBox"; tempListBox.Size = new Size(47, 15); tempListBox.TabIndex = 0; m_listBox = tempListBox; tempListBox = null; } finally { tempListBox?.Dispose(); } return m_listBox; }
protected ListBoxSearch(CustomListBox listBox) { Verify.Argument.IsNotNull(listBox, nameof(listBox)); ListBox = listBox; }
/// <summary>Create <see cref="CustomListBoxColumnsCollection"/>.</summary> /// <param name="listBox">Host <see cref="CustomListBox"/> control.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="listBox"/> == <c>null</c>.</exception> internal CustomListBoxColumnsCollection(CustomListBox listBox) { Verify.Argument.IsNotNull(listBox, nameof(listBox)); ListBox = listBox; }
/// <summary>Create <see cref="CustomListBoxItemsCollection"/>.</summary> /// <param name="listBox">Host <see cref="CustomListBox"/>.</param> /// <param name="parent">Parent <see cref="CustomListBoxItem"/>.</param> internal CustomListBoxItemsCollection(CustomListBox listBox, CustomListBoxItem parent) { _listBox = listBox; _parent = parent; }
internal CustomListBoxSelectedItemsCollection(CustomListBox listBox) { Verify.Argument.IsNotNull(listBox, "listBox"); _listBox = listBox; }
public ReflogSearch(CustomListBox listBox) : base(listBox) { }
/// <summary> /// Create the popup's content /// </summary> /// <returns>The control to add to the popup</returns> protected override Control CreateContent() { m_listBox = new CustomListBox(); m_listBox.BorderStyle = System.Windows.Forms.BorderStyle.None; m_listBox.Dock = System.Windows.Forms.DockStyle.Fill; m_listBox.FormattingEnabled = true; m_listBox.Location = new System.Drawing.Point(0, 0); m_listBox.Name = "m_listBox"; m_listBox.Size = new System.Drawing.Size(47, 15); m_listBox.TabIndex = 0; return m_listBox; }
private void InitializeControls() { closeButton = new StandardButton(15) { Position = new Point(Width - 17, Height - 4), Text = "[ESC] Close" }; closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty); Add(closeButton); itemDetails = new ItemDetailsControl(52, Height - 10, Player) { Position = new Point(Width - 53, 3) }; Add(itemDetails); filterAllButton = new StandardButton(5) { Position = new Point(2, 3), DisabledColor = Color.Blue, Text = "All" }; filterAllButton.Click += (sender, args) => ChangeFilter(FilterType.All); Add(filterAllButton); filterWeaponButton = new StandardButton(5) { Position = new Point(7, 3), DisabledColor = Color.Blue, Text = "─┼ ".ConvertGlyphs() }; filterWeaponButton.Click += (sender, args) => ChangeFilter(FilterType.Weapon); Add(filterWeaponButton); filterArmorButton = new StandardButton(5) { Position = new Point(12, 3), DisabledColor = Color.Blue, Text = "╭█╮".ConvertGlyphs() }; filterArmorButton.Click += (sender, args) => ChangeFilter(FilterType.Armor); Add(filterArmorButton); filterUsableButton = new StandardButton(5) { Position = new Point(17, 3), DisabledColor = Color.Blue, Text = " ▲ ".ConvertGlyphs() }; filterUsableButton.Click += (sender, args) => ChangeFilter(FilterType.Usable); Add(filterUsableButton); filterOtherButton = new StandardButton(5) { Position = new Point(22, 3), DisabledColor = Color.Blue, Text = " ? ".ConvertGlyphs() }; filterOtherButton.Click += (sender, args) => ChangeFilter(FilterType.Other); Add(filterOtherButton); var scrollBarTheme = new ScrollBarTheme { Normal = new Cell(DefaultForeground, DefaultBackground) }; var itemListScroll = new ScrollBar(Orientation.Vertical, Height - 4) { Position = new Point(Width - 55, 6), Theme = scrollBarTheme, CanFocus = false }; Add(itemListScroll); itemsList = new CustomListBox <InventoryStackItem>(Width - 56, Height - 4, itemListScroll) { Position = new Point(1, 6) }; itemsList.SelectionChanged += itemsListBox_SelectedItemChanged; Add(itemsList); RefreshFilterButtonsState(); }
public void Initialize() { closeButton = new StandardButton(15) { Position = new Point(Width - 17, Height - 4), Text = "[ESC] Close" }; closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty); Add(closeButton); editSpellButton = new StandardButton(25) { Position = new Point(Width - 57, 13), Text = "[E] Edit Spell" }; editSpellButton.Click += (sender, args) => EditSpell?.Invoke(this, EventArgs.Empty); Add(editSpellButton); castSpellButton = new StandardButton(25) { Position = new Point(Width - 57, 16), Text = "[C] Cast Spell" }; castSpellButton.Click += (sender, args) => CastSpell?.Invoke(this, EventArgs.Empty); Add(castSpellButton); removeSpellButton = new StandardButton(25) { Position = new Point(Width - 57, 19), Text = "[R] Remove Spell" }; removeSpellButton.Click += (sender, args) => RemoveSpell?.Invoke(this, EventArgs.Empty); Add(removeSpellButton); scribeSpellButton = new StandardButton(25) { Position = new Point(Width - 57, 22), Text = "[G] Write Scroll" }; scribeSpellButton.Click += (sender, args) => ScribeSpell?.Invoke(this, EventArgs.Empty); Add(scribeSpellButton); saveToLibraryButton = new StandardButton(25) { Position = new Point(Width - 30, 16), Text = "[T] Save to Library" }; saveToLibraryButton.Click += (sender, args) => SaveToLibrary?.Invoke(this, EventArgs.Empty); Add(saveToLibraryButton); loadFromLibraryButton = new StandardButton(25) { Position = new Point(Width - 30, 13), Text = "[L] Load from Library" }; loadFromLibraryButton.Click += (sender, args) => LoadFromLibrary?.Invoke(this, EventArgs.Empty); Add(loadFromLibraryButton); spellDetails = new SpellDetailsControl(57, Height - 10, PlayerMana) { Position = new Point(Width - 58, 3) }; Add(spellDetails); var scrollBarTheme = new ScrollBarTheme { Normal = new Cell(DefaultForeground, DefaultBackground) }; var scrollBar = new ScrollBar(Orientation.Vertical, Height - 4) { Position = new Point(Width - 60, 3), Theme = scrollBarTheme }; Add(scrollBar); spellsListBox = new CustomListBox <SpellListBoxItem>(Width - 61, Height - 4, scrollBar) { Position = new Point(1, 3) }; spellsListBox.SelectionChanged += spellsListBox_SelectedItemChanged; Add(spellsListBox); RefreshSpells(); UpdateSpellDetails(); }
public HistorySearch(CustomListBox listBox) : base(listBox) { }
/// <summary> /// 控件模板 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; int tag = Convert.ToInt32(btn.Tag); BaseWindow page = new BaseWindow(); // 简单工厂 switch (tag) { case (int)GlobalStaticStr.WpfDemoList.DemoControlTemplate: page = new DemoControlTemplate(); break; case (int)GlobalStaticStr.WpfDemoList.VisualTreeDisplay: page = new VisualTreeDisplay(); page.showVisualTree(this); break; case (int)GlobalStaticStr.WpfDemoList.ControlsOfControlTemplate: page = new ControlsOfControlTemplate(); break; case (int)GlobalStaticStr.WpfDemoList.CustomListBox: page = new CustomListBox(); break; case (int)GlobalStaticStr.WpfDemoList.ColorPickerDemo: page = new ColorPickerDemo(); break; case (int)GlobalStaticStr.WpfDemoList.FlipPanelDemo: page = new FlipPanelDemo(); break; case (int)GlobalStaticStr.WpfDemoList.ProductDetails: page = new ProductDetails(); break; case (int)GlobalStaticStr.WpfDemoList.BindToCollection: page = new BindToCollection(); break; case (int)GlobalStaticStr.WpfDemoList.DataFormatDemo: page = new DataFormatDemo(); break; case (int)GlobalStaticStr.WpfDemoList.StyleSelectorDemo: page = new StyleSelectorDemo(); break; case (int)GlobalStaticStr.WpfDemoList.DataTemplateDemo: page = new DataTemplateDemo(); break; case (int)GlobalStaticStr.WpfDemoList.ComboBoxDemo: page = new ComboboxDemo(); break; case (int)GlobalStaticStr.WpfDemoList.NavigateCollection: page = new NavigateCollection(); break; case (int)GlobalStaticStr.WpfDemoList.FilterViewDemo: page = new FilterViewDemo(); break; case (int)GlobalStaticStr.WpfDemoList.ViewGruopDemo: page = new ViewGruopDemo(); break; case (int)GlobalStaticStr.WpfDemoList.ListViewDemo: page = new ListViewDemo(); break; case (int)GlobalStaticStr.WpfDemoList.CustomView: page = new CustomView(); break; case (int)GlobalStaticStr.WpfDemoList.TreeViewDemo: page = new TreeViewDemo(); break; case (int)GlobalStaticStr.WpfDemoList.MouseMoveDataGrid: page = new MouseMoveDataGrid(); break; } page.Show(); }
protected ListBoxSearch(CustomListBox listBox) { Verify.Argument.IsNotNull(listBox, "listBox"); _listBox = listBox; }