i m developing in VS 2005 Sp1 and in this particular project, i m using VB.NET.
i created a generic user control that contains labels, picturebox, textboxs.
the values of this controls, are manually loaded from a SQL Server 2005 database records.
i would like to insert all this user controls to the container (custom container ???) with the style like a GridEx or a TableLayoutPanel.
my best goal is: in realtime the users can move each user control over other one, and this one, have to move it automatically to the user control position i selected like a switch between 2 user control.
can somebody help me with some internet link about that or some sample code and what is the correct way to implement that?
thanks a lot..
Lorenzo
Loading
lorenzoPosted Oct 20, 2007, 6:29 AM
Mike GoldPosted Oct 19, 2007, 2:47 PM
You can create the effect of a moving user control by doing the following.
1. On the Mouse Down Event handler, check to see if the user is inside the control
2. If so Hide the control until mouse up. (Visible property = false)
3. In the Mouse Move event handler, invalidate rubberband rectangle that shows the outline of the control on the form so you can draw in the Paint event handler. Draw the rectangle according to the position of the mouse cursor
4. On Mouse up assign a new point to the Location of the user control and set Visible property = true).
I haven't tried this, but I suspect it will work.
Best,