View Single Post
Old Apr 16th, 2008, 10:55 AM   #9
beni_dude
Newbie
 
beni_dude's Avatar
 
Join Date: Apr 2008
Posts: 19
Rep Power: 0 beni_dude is on a distinguished road
Unhappy Re: Dragging and Dropping

Hey
Sadly I'm such a newbie that I couldn't use those examples (even when I tried to do it one by one).

What I'm trying to do is very simple, I want to be a able do drag and drop a control (label) in my form.

In the propriety of the form I enabled the allowDrag to true (I'm not sure what should be enable so I enabled the both the form and the control).

Now I want on the event of enter (I think that the right event that I need to catch, I'm looking for the event that starts when I press on the control) I want to give the the control the same location of the mouse (with its X&Y locations) and here lies the problem.

Let add me code:
Quote:
point p = new point(0, 0);

p.x = MousePosition.X;
p.y = MousePosition.Y;
//Here is the problem
label1.Location.X =p.x;
label1.Location.Y = p.y;
I created an point class that do receive the mouse location (I checked it out when I debugged) but when I try to set the control location (the label) I get this error message:

Quote:
Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable
I understand what the error message mean but I still don't know how to set the location?!
__________________
NULL is all around me!

Last edited by beni_dude; Apr 16th, 2008 at 11:07 AM.
beni_dude is offline   Reply With Quote