drag and drop AND drag

S

SharpCoderMP

i think it would be the best to post this to the "controls" or
"windowsforms" group. they solve this problems all the time :)
also you may want to take a look here: www.bobpowell.net
 
M

Marcel

hello,
I´m trying to do a drag and drop operation and drag the control, just
like a windows icon, is that possible?

my control is a custom form, so I detect the mouseDown event and call
doDragAndDrop()

and override WndProc :

private const int WM_NCHITTEST = 0x84;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCHITTEST && Control.MouseButtons==MouseButtons.Left)
{
System.Console.WriteLine("hit");
Point mousePos = Control.MousePosition;
mousePos.Offset(mouse_offset.X, mouse_offset.Y);
Location = mousePos;
}
else
base.WndProc(ref m);
}

where mouse_offset is initialized in mouseDown callBack

the dragging part is working without problems, but the control where it
is supposed to be dropped isn´t receiving the event, possibly because
the mouse is ove another control..

any comments?

thanks in advance
marcel
 

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