I have a COM-exposed object written in C# for capturing signatures via mouse / stylus etc. (based on MS sample code), which I can embed in a web page.

The capture part of the process works fine - I can retrieve the drawn points without issue. There are a couple of things I'm having trouble with, though.

First, the image clears if I try to print it. I tried Google, and it returned an MSDN page regarding ActiveX reinitialising for printing, clearing anything entered on it. The MSDN page said to use PX_ tags for an ActiveX control to persist its data, but I can't find any information on the .Net / COM equivalent - can anyone point me in the right direction on those?



Second, I want to put in a function to populate the control with a known signature. At the moment, I have the following code which attempts to simulate mouse clicks (since that code already existed)

Code:
Int32 lastx = Int32.Parse(point1[0]), x;
Int32 lasty = Int32.Parse(point1[1]), y;
buildEvent = new MouseEventArgs(MouseButtons.Left, 1, lastx, lasty, 0);

OnMouseDown(buildEvent);
foreach (String point in points)
{                        
    coord = point.Split(',');
    x = Int32.Parse(coord[0]);
    y = Int32.Parse(coord[1]);
    buildEvent = new MouseEventArgs(MouseButtons.Left, 0, x, y, 0);
    OnMouseMove(buildEvent);
}
buildEvent = new MouseEventArgs(MouseButtons.Left, 1, Int32.Parse(coord[0]), Int32.Parse(coord[1]), 0);
OnMouseUp(buildEvent);
This code correctly populates the required data structures (I can retrieve the values with the relevant method), but doesn't actually draw anything. If I put a MessageBox.Show() into the loop, it draws, so I think it's something to do with focus or active states, but I'm not sure which. I've tried invoking

OnPaint()
OnLostFocus()
OnLeave()
OnMouseLeave()

none of which had any noticable effect. Does anybody have any idea what step(s) I'm missing?



Thanks in advance,

Adam