Send form mouse messages to a control on it automatically?

S

SamSpade

I have a control on a form.

Is there a way the control can receive the mouse messages that the form
would normally get?

I know the form could just call a method on the form but wonder if that is
the best way?

Thanks
 
H

Herfried K. Wagner [MVP]

* " SamSpade said:
I have a control on a form.

Is there a way the control can receive the mouse messages that the form
would normally get?

I know the form could just call a method on the form but wonder if that is
the best way?

Call the control's 'FindForm' method to get a reference to the form the
control is placed on. Then use 'AddHandler' to add a handler to the
form's events.
 
S

SamSpade

I just posted a question about a control setting its form to be OnTop.
I think your answer to this will also work for that

Thanks
 
S

SamSpade

Herfried K. Wagner said:
... and I replied...
No there was a second one about a control setting the form to OnTop, but it
seems to have gone off by itself somewhere. Good thing because FindForm
(which I saw right after sending) solved that one too.
 
A

Adam Nowotny

SamSpade said:
I have a control on a form.

Is there a way the control can receive the mouse messages that the form
would normally get?

I know the form could just call a method on the form but wonder if that is
the best way?

Thanks

I have a similiar question. I have a control (inherited from axWebBrowser) on a
form that scrolls it's contents on MouseWheel. I want it react to this event
when using the wheel anywhere on the form. How to acomplish this ?
 
C

Cor

Hi Adam,

Dzien dobry, (dwa razy kontroluje)

I have used the webbrowser intensive, but for this I do not know an answer.
I have not seen an event that matches it, but this is not the reason that I
send this message, it helps you absolutly not the reason from this message
however is to tell you never to attach a question to another messages, that
will seen as an answer.

Make always new message with a new problem.

Cor
 
A

Adam Nowotny

Cor said:
Hi Adam,

Dzien dobry, (dwa razy kontroluje)

One would be enough this time ;-)
I have used the webbrowser intensive, but for this I do not know an answer.
I have not seen an event that matches it, but this is not the reason that I
send this message, it helps you absolutly not the reason from this message
however is to tell you never to attach a question to another messages, that
will seen as an answer.

Make always new message with a new problem.

Cor

Yes Sir ;)
Just thought it's almost the same problem and didn't want to bother people that
had this thread set to "ignore". I'll assume you're right.
Thanks for advice...i havn't used "news" for a looooooooong time...
Should move my questions to more general groups i think :)
 
C

Cor

Hi Adam,

Should move my questions to more general groups i think :)

When you want an answer on this one, I expect you only get it here, but put
it in top.

Cor
 

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