Question

I've been experiemnting with the community version of ILNumerics 3.2.1.0 with .Net 4.0 in Visual Studio 2010 pro on Windows 7, and going through the documentation I succesfully get a windows form project to display a chart, using the code below.

public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();
    }

    private void ilPanel1_Load(object sender, EventArgs e)
    {
        ILSurface mySurface = new ILSurface(ILSpecialData.sincf(100, 200));
        ILPlotCube myCube = new ILPlotCube(twoDMode: false);
        myCube.Add(mySurface);
        ilPanel1.Scene.Add(myCube);
    }
}

If I try exactly the same code but from inside a VSTO Excel 2010 application all that is displayed in the form is the designer view of the ILPanel, blue circle on white background. I don't get any error messages. Am I missing something obvious? or does anyone have a solution of how to get the chart to display in VSTO?

Update

Thanks to Philliproso for pointing out the IsDesignMode() method. As pointed out in various places, including this question, Detecting design mode from a Control's constructor , the following method is not ideal, but for me is has provided a quick fix to allow me to evaluate ILNumerics.

 public static bool IsDesignMode() {
        if (System.Windows.Forms.Application.ExecutablePath.IndexOf("devenv.exe", StringComparison.OrdinalIgnoreCase) > -1)
        {
            return true;
        }
        return false;
}
Was it helpful?

Solution

This is the same issue as here:

Ilnumerics Ilpanel not activating when compiled in a winform into a dll when loaded into matlab in-a-winform-into-a-dll-when-loa

Using VSTO as host for ILNumerics lets the panels assume, it was loaded in a designer. We are currently collecting possible workarounds and solutions. One solution might be to introduce a flag in the Settings of ILNumerics:

Hosted [default: false]

Your situation would require the flag to be enabled. In hosted mode, a blacklist of common designers could be checked at runtime and compared to the current entry assembly. Any other suggestions?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top