Embedding Mogre in Windows Forms control


19-03-2013 16:40:24

Hello! I've just started with a project and we've decided to use Mogre.
Now my intention is to host a Mogre renderwindow in Windows Forms, which is easy enough.
However, I would like it to only take up half of the form's space. Say, I have a 1200x600 Form, I'd only like the renderwindow to take up the leftmost 600x600 pixels.

Earlier I read here that it is possible to host Mogre in various other controls. Is it possible to host the window in a control like a picturebox/panel in an already existing form? Or is there some other solution?


19-03-2013 22:37:33

I've been using a PictureBox control to host my render window. All you have to do is pass the PictureBox's Handle property instead of the Form's.

parameters["externalWindowHandle"] = picturebox.Handle.ToString();

I should note though that input handling though the MOIS library doesn't work properly if you go this route. MOIS can only use the handle of a form. While you can give it the handle of your form, the mouse positions it returns will be relative to the form and not the picture box.


21-03-2013 13:34:58

Thanks, this works perfectly!