kloffy's picture

GameWindow: Access underlying form (ResizeBegin/ResizeEnd events)?

Is there a way to access the underlying Form of a GameWindow on Windows? (I'm aware that this will probably affect portability, but that is not a concern for me.)
I would like to do this in order to be able to hook the ResizeBegin/ResizeEnd events (note that they are different from that what is being exposed through the OnResize method of GameWindow). Of course, if there is an elegant way to tell when the window has started/stopped resizing I'd love to hear about it.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hortus Longus's picture

Hi.

Do you mean Form.ResizeBegin and Form.ResizeEnd?
No?

kloffy's picture

Yes, exactly.
(However, not in a Windows.Forms based application with a GLControl, but in a GameWindow. I do not know how GameWindow is implemented, but I suppose that it is also based on Windows.Forms on Windows...)

kloffy's picture

Alternatively, if there is a way to listen in on the WndProc, using the WM_ENTERSIZEMOVE/WM_EXITSIZEMOVE messages would also be an option.

the Fiddler's picture

GameWindow does not rely on WinForms so there is no underlying form to access. I'd suggest filing a feature request for ResizeBegin / ResizeEnd events.

An inelegant workaround is to install a thread hook to pre-process windows messages (see SetWindowsHookEx and the CallWndProc callback).

Hortus Longus's picture

Do not know for what you need this but you are sure you cannot use the methode as usual?

protected override void OnResize(EventArgs e)
    {
      // your beginReziseStuff here
      base.OnResize(e);
      // your endReziseStuff here
    }

Or you have to think a little:

    // pseudocode
      if ((mouseclick_left) &&
        (mousecursor_over_gamewindow) && (!mousecursor_in_paintingarea)) // means cursor over border, has changed to "<->"
        {
          // your beginReziseStuff here
          base.OnResize(e); // or your own resize-handling
          // your endReziseStuff here
        }

Or you can say what do you will do, perhaps there is a simpler way.

kloffy's picture
the Fiddler wrote:

I'd suggest filing a feature request for ResizeBegin / ResizeEnd events.

Done. (When I tried to link to this thread the system flagged me as spam and wouldn't let me submit.)

the Fiddler's picture

Thanks.

Yeah, the anti-spam system is trigger-happy like that. Better than the alternative, though!