111,120
社区成员
发帖
与我相关
我的任务
分享
[/quote]
你去查查load加载笔迹函数,能不能加载jpg吧。
或者把inkCanv的backgroup换成图片,然后。。。
[/quote]
(inkCanv的backgroup换成图片)这个我试了没用,只能擦除墨迹不能擦除图片。
[/quote]
擦毛。直接尝试换背景啊
[/quote]
你去查查load加载笔迹函数,能不能加载jpg吧。
或者把inkCanv的backgroup换成图片,然后。。。
[/quote]
(inkCanv的backgroup换成图片)这个我试了没用,只能擦除墨迹不能擦除图片。
[/quote]
你去查查load加载笔迹函数,能不能加载jpg吧。
或者把inkCanv的backgroup换成图片,然后。。。
private void button1_Click(object sender, RoutedEventArgs e)
{
try
{
using (FileStream file = new FileStream("C:\\Users\\xxxxxx\\Desktop\\11.bmp",
FileMode.Create, FileAccess.Write))
{
//Ink Serialized Format
if (0 == 1)
{
this.inkCanv.Strokes.Save(file);
file.Close();
}
//bitmap object
else
{
RenderTargetBitmap rtb = new RenderTargetBitmap((int)this.inkCanv.ActualWidth,
(int)this.inkCanv.ActualHeight, 0, 0, PixelFormats.Default);
rtb.Render(this.inkCanv);
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(rtb));
encoder.Save(file);
file.Close();
}
}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Title);
}
}[/quote]
这个不行了,我想实现把图片映射在画布上然后可以在画布上画图点击橡皮擦的时候墨迹跟图片一起擦除。
private void button1_Click(object sender, RoutedEventArgs e)
{
try
{
using (FileStream file = new FileStream("C:\\Users\\xxxxxx\\Desktop\\11.bmp",
FileMode.Create, FileAccess.Write))
{
//Ink Serialized Format
if (0 == 1)
{
this.inkCanv.Strokes.Save(file);
file.Close();
}
//bitmap object
else
{
RenderTargetBitmap rtb = new RenderTargetBitmap((int)this.inkCanv.ActualWidth,
(int)this.inkCanv.ActualHeight, 0, 0, PixelFormats.Default);
rtb.Render(this.inkCanv);
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(rtb));
encoder.Save(file);
file.Close();
}
}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Title);
}
}