Determine when dragging a form has stopped.

B

Bob Johnson

How can I programmatically determine when a MDI child form has been dragged
from one location to another within its MDI parent form? Ideally I'd like to
trap some event that occurs when the dragging has stopped.

Thanks.
 
J

John Sheppard

Id say the dragging stops when the user lets go of the mouse button...

As for stopped moving I guess you could make ur own event....

Im a noob tho so im not sure...
 
B

Bob Johnson

Hi John,

If you are not sure, or don't even have the foggiest idea of how to be
helpful here, then please feel free to NOT respond.

The problem with responding with useless information - as you did here - is
that it creates the perception that the question has in fact been answered.
The problem here is that others who might know the answer or could be
actually helpful might not bother to read the original question.

BTW: How in the world would you- in your best of intentions - think that
your answers could be in any way helpful? Am I supposed to read what you
wrote and think - "yes - that's it!". Sheesh. "user let's go of the mouse
button. Okay - great - how do we trap for that? "make ur own event" -
what? "ur" --- you are apparently so lazy that you can't even write out
"your". And even if I can get past that (which I can), then, okay I'll
write my own event... followup question for you then - when do I fire my own
event? - let me gusss - when the user "lets go" of the mouse button. Okay
great - how do we determine that? Oh, let me guess - I'll write my own
event. Wash, rinse, repeat - brilliant!

-Bob
 
P

Peter Duniho

Hi John,

If you are not sure, or don't even have the foggiest idea of how to be
helpful here, then please feel free to NOT respond.

The problem with responding with useless information - as you did here - is
that it creates the perception that the question has in fact been answered.
The problem here is that others who might know the answer or could be
actually helpful might not bother to read the original question.

For what it's worth, the thing most likely to get in the way of you
getting a good answer to your question is the broad, inappropriate
cross-posting. The more newsgroups you include, the more likely it is
you'll attract answers from someone who isn't going to provide the
answer you want or think is useful.

Also, I don't really see the point in berating the answer you got.
Maybe it wasn't really helpful, but I didn't see any sign that the guy
was yanking your chain. Assuming he was really trying to help,
criticizing him isn't a great way to encourage other people that also
might really try to help.

Pete
 
B

Bob Johnson

<snip>

RE:
The point is to discourage such useless posts... my little part to help with
the signal-to-noise ratio. And yes, I know, explaining that, in itself,
hurts the signal-to-noise ratio...

RE:Gotcha - maybe just the winforms group would have been best. I did think
about it before doing it, though... seems like nobody knew the answer to my
earlier/similar question from yesterday - so figured I'd widen the scope a
bit and refocus the question. I didn't know that 3 groups would be
considered as "broad"... I'll take that into account in the future.

Back to the OP: After all this there is apparently there is no way to
determine when a user has stopped moving/dragging a mdi child form. Do you
have any ideas on that?
 
J

John Sheppard

Sorry,

Perhaps it wasnt helpful...but sometimes when no one else can answer little
things can trigger to help you think of other things...just offering what
little I know is all...

I guess what I was trying to get at, was that do you mean drag and drop as
you want to track when the mouse button is let go, or do you mean move as in
when the drag moves over a pixel...I realise i didnt state that very well
and that wasnt very helpful.

How could you have an event that determines when it stops moving? that would
require a timer and as far as I know there is no property that stores one.
So I'd guess youd have to make your own...

John
 
D

DeveloperX

<snip>

RE:


The point is to discourage such useless posts... my little part to help with
the signal-to-noise ratio. And yes, I know, explaining that, in itself,
hurts the signal-to-noise ratio...

RE:>> broad, inappropriate cross-posting.

Gotcha - maybe just the winforms group would have been best. I did think
about it before doing it, though... seems like nobody knew the answer to my
earlier/similar question from yesterday - so figured I'd widen the scope a
bit and refocus the question. I didn't know that 3 groups would be
considered as "broad"... I'll take that into account in the future.

Back to the OP: After all this there is apparently there is no way to
determine when a user has stopped moving/dragging a mdi child form. Do you
have any ideas on that?

Actually John's solution wasn't entirely daft and I commend him for at
least trying to help. It won't work in this case because mouse events
are only raised in the client region, but his suggestion is used
commonly in many other situations so you really owe him an apology.

On topic, See if you can figure out what to do with the following:

private const int WM_NCMOUSEMOVE = 0xa0;
private const int WM_NCLBUTTONDOWN = 0xa1;
private const int WM_NCLBUTTONUP = 0xa2;
private const int HTCAPTION = 2;
private const int SC_MOVE = 0xF010;
private const int WM_SYSCOMMAND = 0x0112;

protected override void WndProc(ref System.Windows.Forms.Message
pMessage)
{
switch (pMessage.Msg)
{
case WM_NCMOUSEMOVE:
Console.WriteLine("WM_NCMOUSEMOVE");
break;
case WM_NCLBUTTONDOWN:
Console.WriteLine("WM_NCLBUTTONDOWN");
break;
case WM_NCLBUTTONUP:
Console.WriteLine("WM_NCLBUTTONUP");
break;
case HTCAPTION:
Console.WriteLine("HTCAPTION");
break;
case SC_MOVE:
Console.WriteLine("SC_MOVE");
break;
case WM_SYSCOMMAND:
Console.WriteLine("WM_SYSCOMMAND");
break;
}

base.WndProc(ref pMessage);
}
 
B

Bob Johnson

private const int WM_NCMOUSEMOVE = 0xa0;
private const int WM_NCLBUTTONDOWN = 0xa1;
private const int WM_NCLBUTTONUP = 0xa2;
private const int HTCAPTION = 2;
private const int SC_MOVE = 0xF010;
private const int WM_SYSCOMMAND = 0x0112;

protected override void WndProc(ref System.Windows.Forms.Message
pMessage)
{
switch (pMessage.Msg)
{
case WM_NCMOUSEMOVE:
Console.WriteLine("WM_NCMOUSEMOVE");
break;
case WM_NCLBUTTONDOWN:
Console.WriteLine("WM_NCLBUTTONDOWN");
break;
case WM_NCLBUTTONUP:
Console.WriteLine("WM_NCLBUTTONUP");
break;
case HTCAPTION:
Console.WriteLine("HTCAPTION");
break;
case SC_MOVE:
Console.WriteLine("SC_MOVE");
break;
case WM_SYSCOMMAND:
Console.WriteLine("WM_SYSCOMMAND");
break;
}

base.WndProc(ref pMessage);
}

Perfect! Thank you so much. Not only is this a big shove in the right
direction, but I can see possible uses for it beyond my immediate needs.

RE: the other guy - the self-poclaimed "noob" (whatever that is), here is
some excellent reading:



While that article is about posting questions, many of the points and
certainly the spirit of the document can easily be generalized to responding
to questions. The document is a bit lengthy, so I'll point out that one
important point the document states is that it's totally unhelpful - even
irrellevant to anything - to point out oneself as a "newbie" (or "noob" for
the lazy). Why the self-effacing blather? It's unprofessional, unhelpful,
and irrellevant. And we're not "texting" each other here. So no need to go
with all the contractions... r u ok wit dat? ROTFLMAO! How are we supposed
to take you seriously when you come to this group with that (rhetorical
question).

-Bob
 
J

John Sheppard

if its a decent document, and I don't know cause I'm not going to read
it....Id say it says stuff about pejoratives and narcissism...

John
 
B

Bob Johnson

it....Id say it says stuff about pejoratives and narcissism...

Speaking of pejoratives - referring to onesself as a "noob" is quite the
pejorative. And I agree with you 100% if you are implying that such
pejoratives should be avoided.

-Bob
 

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