0

How can I pass Mouse Move events to the parent control but then continue to use the same Mouse Events in the child control?

So far tried this but then I cannot use Mouse events on my child control.

protected override void WndProc(ref Message m) {
    const int WM_NCHITTEST = 0x0084;
    const int HTTRANSPARENT = (-1);

    if (m.Msg == WM_NCHITTEST)
        m.Result = (IntPtr)HTTRANSPARENT;
    else
        base.WndProc(ref m);
}
stuartd
  • 70,509
  • 14
  • 132
  • 163
fetix
  • 11
  • 4
  • 1
    https://stackoverflow.com/a/7934957/17034 – Hans Passant Nov 06 '22 at 02:47
  • 2
    You should probably clarify your intentions and context, because what you're asking is the opposite of what the code does, i.e., you're asking, in code, not to receive mouse messages, but you also want to receive mouse messages. E.g., are you trying to move a border-less Form using a fake Caption? – Jimi Nov 06 '22 at 03:07
  • I have two separate controls, trackbars that are within a panel, I want to be able to update both with Mouse events when hovering over the trackbar(s). The code was just an example of what I have already tried with no success to achieve my *hopefully* end result. – fetix Nov 06 '22 at 18:50

0 Answers0