opentk / GLControl

WinForms control for OpenTK 4.x.
https://opentk.net
Other
54 stars 24 forks source link

Design mode problem when subclassing. #16

Closed IVTore closed 2 years ago

IVTore commented 2 years ago

I am building a class library with .Net 5. Designer does its brilliant job by giving exception messages which goes nowhere :) . Is it impossible to subclass GLControl? I am using the wrapper approach as a workaround for now.

NogginBops commented 2 years ago

Are there any exception messages, any stack traces? Anything other we can use to diagnose the issue you are having?

To my knowledge it should be possible to subclass GLControl, but @seanofw might know more details.

seanofw commented 2 years ago

The GLControl can be subclassed (it's not marked sealed for a reason), but some care must be taken when subclassing it:

It's safest not to subclass it and to instead bind to the events it raises, but there's no explicit prohibition on doing so. Just be aware that subclassing is effectively using it in "expert mode," so if you don't know WinForms and Win32 inside-out upside-down and backwards, you may run into trouble.

IVTore commented 2 years ago

Thank you for your enlightening answers. Since I am not after being a winforms guru, (why restrict myself?) I will keep on wrapping approach, which is working fine.