您好,
根据您的描述,建议您参考下面的示例工程:
#Erase to Transparency (WriteableBitmap)
http://code.msdn.microsoft.com/Erase-to-Transparency-caa261a1
这个Demo 可以加载一幅图片之后,使用鼠标涂抹掉图片,就像橡皮擦功能一样。
以下的方法可以根据您鼠标的位置,擦除图片的一部分:
static public void Rubber(int x, int y, int RubberWidth, int rubberHeight, WriteableBitmap image)
{
var halfRubberWidth = RubberWidth / 2;
var halfRubberHeight = rubberHeight/2;
if (x > (image.PixelWidth - halfRubberWidth) ||
y > (image.PixelHeight - halfRubberHeight) ||
x < halfRubberWidth || y < halfRubberHeight) return; // Boundaries
int stride = image.PixelWidth * image.Format.BitsPerPixel / 8;
int byteSize = stride * image.PixelHeight * image.Format.BitsPerPixel / 8;
var ary = new byte[byteSize];
image.CopyPixels(ary, stride, 0);
var curix = ((y-10) * stride) + ((x-10) * 4 );
for (var iy = 0; iy < rubberHeight; iy++)
{
for (var ix = 0; ix < RubberWidth; ix++)
for (var b = 0; b < 4; b++)
{
ary[curix] = 0;
curix++;
}
curix = curix + stride - (RubberWidth * 4);
}
image.WritePixels(new Int32Rect(0, 0, image.PixelWidth, image.PixelHeight), ary, stride, 0);
}

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.