[3.0/LINQ] inheriting forms.
I have another form (camera.cs) which inherits from LayeredForm. This works perfectly when compiled, however in design mode it says "Error Creating Window Handle"
But since camera.cs is all dynamic (ie no controls on it jus stuff being painted on) its perfectly fine. However I want to create another form and put controls on it so I'd like to inherit from this form.
its a small class (couple of methods) but I think the problem arises becuase it uses GDI to draw the form.
http://pastebin.com/m33b54bb3
Re: [3.0/LINQ] inheriting forms.
Did you use the Inherited Form item template when you added the derived class to your project, or did you use the Windows Form item template and then hook it up yourself?
Re: [3.0/LINQ] inheriting forms.
I used the inherited form function. (then I tried doing it manually also)
Both resulted in that error, (however it works when compiled).. so i have no idea whats going on.
Re: [3.0/LINQ] inheriting forms.
So LayeredForm is the base and Camera is the derived class, correct? You're saying that Canera won't display in the designer? After creating a derived form does it not display in the designer immediately? If it does display, what changes have you made to Camera?
Re: [3.0/LINQ] inheriting forms.
Quote:
Originally Posted by jmcilhinney
So LayeredForm is the base and Camera is the derived class, correct? You're saying that Canera won't display in the designer? After creating a derived form does it not display in the designer immediately? If it does display, what changes have you made to Camera?
That is correct. Here is a screenshot when I try to pull up "camera" in Design mode.
http://www.kalleload.net/uploads/qnfvwqckkaxv.jpg
However, the layeredForm (base class) loads fine..
http://www.kalleload.net/uploads/gimxkoehcihx.jpg
Re: [3.0/LINQ] inheriting forms.
edit: double post due to bug in IE8.
Re: [3.0/LINQ] inheriting forms.
Have you viewed the call stack?
Re: [3.0/LINQ] inheriting forms.
Yes I did, which leads me to believe that the error is because I am using GDI to draw the form rather then .net I think. here is the call stack.. or the first couple of lines.
Quote:
System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Design.DesignerFrame.Initialize(Control view)
at System.Windows.Forms.Design.DocumentDesigner.Initialize(IComponent component)
at System.Windows.Forms.Design.FormDocumentDesigner.Initialize
The only thing I can find related to the call stack is:
csharp Code:
#region Windows Message Handling
protected override CreateParams CreateParams
{
get
{
CreateParams cParams = base.CreateParams;
cParams.ExStyle |= NativeMethods.WS_EX_LAYERED;
return cParams;
}
}
#endregion
What I dont get is how can it compile and run perfectly fine? I think its because all the painting is done in the camera constructor..