1

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;
}
Community
  • 1
  • 1
  • Did you make it running in VSTO that way? Just curious how does it perform ? – user492238 Jul 26 '13 at 17:20
  • Yes, the control displayed correctly in VSTO, although was quite slow. Don't know if that is the control or the fact it is running in VSTO. I've only just started to evaluate ILNumerics, so early days. – Sharp Statistics Jul 27 '13 at 12:16
  • It probably switched to GDI rendering. I was not able to get OpenGL running on my machine either. It's a notebook and uses onboard Intel Software Emulator only. May not related to ILNumerics though. Thanks! – user492238 Jul 28 '13 at 17:12

1 Answers1

1

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?

Community
  • 1
  • 1
Haymo Kutschbach
  • 3,322
  • 1
  • 17
  • 25
  • 1
    Yeah I have an open a bug report, the problem lies with the ILNumerics.Drawing.ILHelper.IsDesignMode method hopefully gets fixed soon – Philliproso Jul 25 '13 at 06:22