Implement Drag & Drop of Custom Controls at Runtime

arya

New member
Joined
Jan 23, 2006
Messages
3
Programming Experience
3-5
Hello guys.

I am almost alien to Graphics in Vb.Net, but am pretty conversent otherwise.

I would request you to help me on the following:
  • How to implement Drag & Drop of Custom Controls at Runtime?
  • How to draw a line depending on two mouse-click locations on two different controls, and later curve it, depending on clicks?
P.S. I am trying to design a simulator of digital circuits, the controls would be the gates and the line, the connecting wire.
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner

tyonuts

Well-known member
Joined
Dec 27, 2005
Messages
78
Location
Romania
Programming Experience
3-5
if you just want to move your controls, try the following:

'Declare the following:
Private Declare Function ReleaseCapture lib "user32"() as Integer

Private Declare Function SendMessage lib "user32" (hWnd as Integer, Msg as Integer, wParam as Integer, lParam as integer) as integer

Private Const WM_NCLBUTTONDOWN as Short=&HA1S


'and in the MouseMOve code of the control u want to move write this:

ReleaseCapture()
SendMessage(ctrl.Handle.ToInt32,WM_NCLBUTTONDOWN, 2, 0&)

'where ctrl is the name of your control.
 
Top Bottom