Drag/Drop custom controls

C

Curtis Justus

Hi,

My goal is to have a series of thumbnail images on a control/panel and to
drag/drop those items onto another control (i.e. a treeview). I am able to
drag one item and need to somehow select more than one thumbnail image. I
would like to use the Control key/Left Mouse Click to select more than one
item. Unfortunately, the picturebox control doesn't seem to have a
mouse-based click event that shows if the control key is pressed.

Is there a control or code out there that will allow me to do what I'm
trying to do? If not, does anybody have any advice for what I should try?

Thanks,
cj
 
J

J.Marsch

It's conveniently hidden, but I think that you just want to check
Control.ModifierKeys. This is a static property that is a member of Control
class. This example code is copy/pasted directly from the Control.Modifiers
help:

private void button1_Click(object sender, System.EventArgs e)
{
/* If the CTRL key is pressed when the
* control is clicked, hide the control. */
if(Control.ModifierKeys == Keys.Control)
{
((Control)sender).Hide();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top