Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
Topic closed
I have a list of elements and I want to display them in a C# form.
Eg.:
abc
bcd
cde
def
I want to live rearrange them thought drag & drop.
Here's a video:
So... Theres a Win Form Element for that? I don't need fancy images, the elements would be just strings.
Thanks!
Everybody edits, but some edit more than others
Offline
your question, from stack overflow
herebasically, you could use a list view, or a really hacked listbox
Thanks.
For those who may want same thing Ill post the code:
private void listBox1_MouseDown(object sender, MouseEventArgs e) {
if (listBox1.SelectedItem == null) return;
listBox1.DoDragDrop(listBox1.SelectedItem, DragDropEffects.Move);
}
private void listBox1_DragOver(object sender, DragEventArgs e) {
e.Effect = DragDropEffects.Move;
}
private void listBox1_DragDrop(object sender, DragEventArgs e) {
Point point = listBox1.PointToClient(new Point(e.X, e.Y));
int index = listBox1.IndexFromPoint(point);
if (index < 0) index = listBox1.Items.Count - 1;
object data = e.Data.GetData(typeof(string));
this.listBox1.Items.Remove(data);
this.listBox1.Items.Insert(index, data);
}
Don't forget to AllowDrop in listbox propriety.
Everybody edits, but some edit more than others
Offline
Pages: 1
Topic closed
[ Started around 1732445223.4101 - Generated in 0.054 seconds, 13 queries executed - Memory usage: 1.43 MiB (Peak: 1.55 MiB) ]