AnsweredAssumed Answered

TaskpaneView.AddControl question

Question asked by Kirill Sergeev on Jan 14, 2011
Latest reply on Aug 18, 2018 by Liu Xubo

Hello!

 

I'm writing an add-in for SolidWorks 2010 (C#).

Previously I've made a (working) plugin for SolidWorks 2008, here is a part of is's code:

...

namespace SWBPlugin
{
      public class SWIntegration : ISwAddin
      {
      public SldWorks mSWApplication;
      private int mSWCookie;

      private TaskpaneView mTaskpaneView;
     private SWTaskpaneHost mTaskpaneHost;

 

....

 

private void UISetup()
      {
      try
      {
          mTaskpaneView = (TaskpaneView)mSWApplication.CreateTaskpaneView2("", "Plugin Title");
          mTaskpaneHost = (SWTaskpaneHost)mTaskpaneView.AddControl(SWTaskpaneHost.SWTASKPANE_PROGID, "");
           mTaskpaneHost.pSWApplication = mSWApplication;
      }

...

 

The problem I'm facing is the following:   mTaskpaneHost is null, so there is nothing but the title (Plugin Title) in the right panel.

The decaration of the TaskpaneHost class:

 

public partial class SWTaskpaneHost : System.Windows.Forms.UserControl

 

They say, SolidWorks 2010 doesn't support System.Windows.Forms.UserControl.

 

So, what should I do to make my plugin to work in SW 2010?

 

Thanks to everyone!

Outcomes