|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace Oli.Controls.Tests
{
public partial class TestDragDropListBox : UserControl
{
public TestDragDropListBox()
{
InitializeComponent();
dragDropListBoxBindingSource.DataSource = dragDropListBox;
cboSelectionMode.DataSource = Enum.GetNames(typeof(SelectionMode));
cboSelectionMode.Text = "MultiExtended";
}
public void AddItemsRange(object[] items)
{
dragDropListBox.Items.AddRange(items);
}
[Category("Behavior (drag-and-drop)"),
DefaultValue(""),
Description("Drag-and-drop group to which the DragDropListBox belongs. Drag-and-drop is restricted to happen between DragDropListBoxes having the same DragDropGroup.")]
public string DragDropGroup
{
get { return dragDropListBox.DragDropGroup; }
set { txtGroup.Text = value; dragDropListBox.DragDropGroup = value; }
}
private void cboSelectionMode_SelectedIndexChanged(object sender, EventArgs e)
{
dragDropListBox.SelectionMode = (SelectionMode)Enum.Parse(typeof(SelectionMode), cboSelectionMode.Text);
}
private void btnSelectEven_Click(object sender, EventArgs e)
{
for (int i = 0; i < dragDropListBox.Items.Count; i++) {
dragDropListBox.SetSelected(i, i % 2 == 0);
}
}
private void chkSorted_CheckedChanged(object sender, EventArgs e)
{
dragDropListBox.Sorted = chkSorted.Checked; // DataBinding doesn't work well (list isn't sorted immediately).
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Apprenticeship as machine draughtsman.
School of engineering in electrical engineering.
Started programming as hobbyist. After some years as a programmer in the industry, I have made myself independent.
I speak: French, German, (some) English.
Languages: C#, VB.NET, Basic, Pascal, Modula-2, Oberon-2, VBA.
Databases: FoxPro, MS-Access, SQL-Server, Oracle.
Hobbies: Astronomy, space, science fiction, travel, nature.