I am trying to save a QR Bar Code as an image and not having much luck. Anyone have a small sample of code to do so? New to WPF and what I have found on the web so far doesn't seem to work for me.
Also if you have any insight into printing that would be great also.
Thanks,
Nick
Hi Nick,
for example if you have one "Save" button then you should implement the following code:
private
{
WriteableBitmap bitmap = new WriteableBitmap((int)BarCode.ActualWidth,
(int)BarCode.ActualHeight);
bitmap.Render(BarCode,
new TranslateTransform
() { X = 0, Y = 0 });
bitmap.Invalidate();
SaveToDisk(bitmap);
}
private void SaveToDisk(WriteableBitmap bitmap)
var
Microsoft.Win32.SaveFileDialog saveFileDialog =
new Microsoft.Win32.SaveFileDialog();
saveFileDialog.DefaultExt =
"png";
saveFileDialog.Filter =
"PNG Files (*.png)|*.png";
saveFileDialog.FilterIndex = 1;
if (saveFileDialog.ShowDialog() == true
)
I hope it will help you.
Vania