I am trying to integrate my application with several others.
In one case I am getting the following exception:
System.InvalidOperationException was unhandled by user code
Message=SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.
There is no way to know if a IWin32Window was already created in my context (the framework doesn't offer it).
The only possible work around, is having your own Custom Form that inherits from Winforms Form. That way you can get when the forms are being created.
I can not do that, because my app gets integrated with many other, and I could not force them all to use other than Windows Form.
We were trying to save some time to the applications we were integrating with, however when we started having this error we removed the code, and stablished they should be the ones to configure the compatibility settings.