Aha! The problem is the TextBlock txtLabel that is directly above the InkCanvas. When you remove that the black line disappears.
As for why that is happening, I'm not entirely sure yet.
Aha! The problem is the TextBlock txtLabel that is directly above the InkCanvas. When you remove that the black line disappears.
As for why that is happening, I'm not entirely sure yet.
Jason i solvo this problem. Sorry my English. i am Russian. You need set property inkCanvas.Margin is 0,0,0,0 that surface.Margin = new Thickness(0, 0, 0, 0); after saving set margin in you posicion
exaple: i nave
surface.Margin = new Thickness(0, 0, 0, 0); http://img189.imageshack.us/img189/7499/mynewimage.png
and surface.Margin = new Thickness(55,40,96,5); http://img519.imageshack.us/img519/7499/mynewimage.png
My class save image
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
public void ExportToJpeg(String path, InkCanvas surface)
{
double
x1 = surface.Margin.Left,
x2 = surface.Margin.Top,
x3 = surface.Margin.Right,
x4 = surface.Margin.Bottom;
if (path == null) return;
surface.Margin = new Thickness(0, 0, 0, 0);
Size size = new Size(surface.Width, surface.Height);
surface.Measure(size);
surface.Arrange(new Rect(size));
RenderTargetBitmap renderBitmap =
new RenderTargetBitmap(
(int)size.Width,
(int)size.Height,
96,
96,
PixelFormats.Default);
renderBitmap.Render(surface);
using (FileStream fs = File.Open(path, FileMode.Create))
{
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(renderBitmap));
encoder.Save(fs);
}
surface.Margin = new Thickness(x1, x2, x3, x4);
}