Make an ActiveX control work without a form?

Posted by Earlz on Stack Overflow See other posts from Stack Overflow or by Earlz
Published on 2010-05-25T18:34:52Z Indexed on 2010/05/25 18:41 UTC
Read the original article Hit count: 452

Filed under:
|
|
|
|

We are using Topaz Signature pads. They provide their APIs in the from of an ActiveX control which is to be put on a Winform control. Well, the way our project will work we do not want to have a form(at least not visible). We just want for the signature ActiveX control to get an image in the background.

static AxSigPlus sig = new AxSIGPLUSLib.AxSigPlus();

public static void Begin()
{
    ((System.ComponentModel.ISupportInitialize)(sig)).BeginInit();
    sig.Name = "sig";
    sig.Location = new System.Drawing.Point(0, 0);
    sig.Size = new System.Drawing.Size(0, 0);
    sig.Enabled = true;

    sig.TabletState = 1; //error here
    sig.SigCompressionMode = 0;
}

Ok so I get an error at the marked line. The exception is

Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.

What do I do to solve this problem? Would it just be easier to create a new hidden form and put the control on it so it's invisible?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms