Hi everybody,
I am problem with restoring data of byte[] type to be loaded on an Ink
object. The data was earlier converted to byte[] then finally to hexadecimal
data and store on a text file. Is there anyone who can help me solve this
problem. Thanks.
Note: The Ink object is from Microsoft.Ink namespace.
Code:
private void LoadXML()
{
try
{
// This object will encode our byte data to a UTF8 string
UTF8Encoding utf8 = new UTF8Encoding();
Ink loadedInk = new Ink();
string filePath = Application.StartupPath + "\\siganture.txt" +
StreamReader sreader = new StreamReader(filePath);
string Signature = sreader.ReadToEnd();
// load the ink into a new ink object
// once an ink object has been "dirtied" it can never load ink again
loadedInk.Load(utf8.GetBytes(strSignature)); <- Error Occurs here
// temporarily disable the ink collector and swap ink objects
ic.Enabled = false;
ic.Ink = loadedInk;
ic.Enabled = true;
// Repaint the inkable region
this.pictureBox.Invalidate();
}
catch (Exception ex)
{
//error handling processes
}
}
Error Message:
"System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic
failure\r\n at Microsoft.Ink.InkDispClass.Load(Object Data)\r\n at
Microsoft.Ink.Ink.Load(Byte[] inkdata)\r\n at SignatureForm.LoadSiganture()
in c:\\....\\signatureform.cs:line 2163\r\n at
signatureForm.btnCancel_Click(Object sender, EventArgs e) in
c:\\...\\signatureform.cs:line 705\r\n at
System.Windows.Forms.Control.OnClick(EventArgs e)\r\n at
System.Windows.Forms.Button.OnClick(EventArgs e)\r\n at
System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)\r\n at
System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button,
Int32 clicks)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n
at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n at
System.Windows.Forms.Button.WndProc(Message& m)\r\n at
System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)\r\n
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)\r\n at
System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)\r\n at
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)\r\n at
System.Windows.Forms.ComponentManager.System.Windo ws.Forms.UnsafeNativeMethods+IMsoComponentManager. FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at
System.Windows.Forms.ThreadContext.RunMessageLoopI nner(Int32 reason,
ApplicationContext context)\r\n at
System.Windows.Forms.ThreadContext.RunMessageLoop( Int32 reason,
ApplicationContext context)\r\n at
System.Windows.Forms.Application.Run(Form mainForm)\r\n at MainForm.Main()
in c:\\....\\mainform.cs:line 557"
den2005
--
MCP Year 2005, Philippines
--
MCP Year 2005, Philippines