I’d like to draw an image (like a bar code) pixel-by-pixel in a Visual Basic .NET WPF Application and …
- show the image in my UI
- copy it to the clipboard
- save it as a .BMP-File.
It should also be possible to add Paint-like editing features later.
What is a good approach?
System.Drawing.Bitmap works internally, but the only way I could show it is to convert it to an ImageSource and show it inside an Image control. Is there any better way?
I think
WriteableBitmapmight help, it already is anImageSource. Check out the documentation for some usage examples. I have not used this for a long time so i cannot help you with it, possibly searches on this site may turn up some useful info as well.As
WriteableBitmapis aBitmapSourceyou can just useClipboard.SetImageto copy it.To save images you can in general use a subclass ob
BitmapEncoder(also see doc for usage; you probably want to use theBmpBitmapEncoder).