Usercontrol in a Listview?

  • Thread starter Thread starter Jmc
  • Start date Start date
J

Jmc

Hi
I would like to add a number och usercontrols (cotaning a pppicture and
a couple of lines of text) to a listview(?) or something like that.
I need to be able to mark my controls, use drag and drop and so on.
The finished product will look simular to Windows explorer in thumbnail
mode.
Any suggestions?

/Jimmy
 
Its that easy?
I didn't think it worked that way, so I didn't even try =)
I should have known better =)

Thanks
/Jimmy
 
hi
just tried the solution you suggested, seems to work on the first
control only.

I tried this code:
for (int a=10;a>0;a--)
{
UserControl1 uc=new UserControl1();
uc.label1.Text=a.ToString();
listView1.Controls.Add(uc);
}

The usercontrol1 only contains a label named label1.
when I run this only get an uc with the labeltext "10".
What I'm I doing wrong?

/JImmy
 
Hi Jimmy,

I guess all controls were added but since you don't provide positioning
information for your controls, there are all at the same location (0,0).
Since you added the control with text "10" first, it is the only visible
control, the others are simply behind.

Try this code:
for (int a=10;a>0;a--)
{
UserControl1 uc=new UserControl1();
uc.label1.Text=a.ToString();
uc.Top = a * 10;
listView1.Controls.Add(uc);
}
 
Hi
You are right I think I need to learn to try before asking =)
But I can't seem to be abl to move them around (like in a listview) how
can I implement drag and drop?
Is there any way to use the vs 2005 flowcontrol to do this? I was
hoping that I didn't have to control positioning my self.
(I'm using vs 2005)

Basically I want to show a number och usercontrols and be able to mark
1 or more and also use drag end drop.
Listview is perhaps not the way to go? Perhaps the flowcontrol is more
right.
But I can't seem to be able to mark my user controls, not in either
Listview och flowcontrol.
/Jimmy
 
I found a couple of good articles on the subject, so I know how to
handle drag and drop but the beeing able to mark one oc many uc's i'm
not sure of.
Any suggsetions?
/Jimmy
 
Back
Top