Adding Mogre UserControl to VS 2008

Munki

13-04-2011 23:57:44

has anybody successfully been able to add a Mogre usercontrol in the design view of vs2008?

Or do we have to put a proxy in and get a handle at runtime?

Thanks.

smiley80

14-04-2011 09:54:45

Yes, it's possible.
Make sure 'ogremain.dll' is in PATH; and don't initialize Ogre in the constructor, instead override 'OnLoad' and check 'DesignMode', e.g.:
protected override void OnLoad(EventArgs e)
{
if (!this.DesignMode)
{
mogreWin = new OgreWindow(new Point(100, 30), mogrePanel.Handle);
mogreWin.InitMogre();
}
base.OnLoad(e);
}

Munki

16-04-2011 00:33:47

I've been trying to get this working but I'm finding I having issues.

everything goes fine until I overload OnLoad, then I get errors in my design view if I've already added the mogre usercontrol.

then when I go to my design view (which I've already added my user control to) I get the following error:

The variable 'ogrePanel1' is either undeclared or was never assigned.

at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)

any ideas?

smiley80

16-04-2011 01:18:24

Close all tabs.
Open the form's designer file (*.designer.cs) and remove all lines that contain 'ogrePanel1'.
Rebuild.
Open the design view tab again and readd the usercontrol.