View Single Post
  #1 (permalink)  
Old 05-06-2007, 07:31 AM
njhartley@gmail.com
Newsgroup Contributor
 
Posts: n/a
Saving / Loading Ink Data


I am trying to follow the example on:

http://msdn2.microsoft.com/en-us/library/aa480684.aspx

And have created a simple control -

1 InkPicture
1 TextBox
3 Buttons

The code for the buttons are:

private void button2_Click(object sender, EventArgs e)
{
inkPicture1.Ink.DeleteStrokes();
inkPicture1.Refresh();
}

private void button1_Click(object sender, EventArgs e)
{
byte[] inkBytes =
inkPicture1.Ink.Save(PersistenceFormat.Gif);
textBox1.Text = Convert.ToBase64String(inkBytes);
}

private void button3_Click(object sender, EventArgs e)
{
byte[] inkBytes = Convert.FromBase64String(textBox1.Text);
inkPicture1.Ink.Load(inkBytes);
inkPicture1.Invalidate();
}

So what I am trying to acheive is

1) Draw some ink on the inkpicture
2) Click on button1 and store the ink as a Base64String somewhere
(textBox1.Text)
3) Click on button2 to clear the page
4) Click on button3 to restore the ink back ot the ink control

Stage 2 seems to work - populates the textbox with a string
Stage 3 is fine - clears the picture
Stage 4 when I try to load the ink fails ("Value does not fall within
the specified range")

What am I doing wrong?

Reply With Quote

 
Old 05-06-2007, 07:31 AM