There is a WinForms
project that uses both, i.e. on one form, both System.Windows.Forms.DataVisualization.Charting.Chart
, and ActiveX
, written in ancient Borland C++ Builder 6
.
As it turned out, together they are not very good friends, but there are strange effects:
The application works on one machine, but when you first open the form, a white background is drawn instead of a graphic. When you re-open everything is fine. You can also solve the problem by calling
Refresh
once on the timer after the form is loaded (instead of reopening).In another situation,
System.ArithmeticException
comes out, according to which an article about the possible reason for such behavior was found:
Certain functions of some versions of Delphi, c ++ like to change the bit in the CW FPU register to such a value that the poor math co-processor stops digesting double.NaN, starting to spit on it with exceptions. And in WPF, as you know, a good half of the FrameworkElement properties have the default value set to NaN. At the slightest manipulation of these properties, the application begins to fall.
But if in the case of P/Invoke
is less clear, i.e. called the function, returned the registers, everything is OK. In the case of a parallel running ActiveX
it is somehow unclear at what point these registers should be edited.
In the third case, when trying to open such a form in the designer, the Visual Studio IDE just drops.
Well, in the fourth situation (another computer), it comes out:
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.DataVisualization.dll
when trying to run a bare application from the same form with the two components mentioned on it.
Source codes are available (i.e., can be modified), but, unfortunately, I cannot publish them.
I am wondering how to solve the problem of the coexistence of these components on one form. Your ideas?