Paint in A Grid And Export Image? (Windows or Mac)
I want the user to be able to paint in a grid in my Windows application 16x16 pixels large. Of course these are visiably bigger when editing but then can be output as a png file at its actual 16x16 size.
Im 开发者_JAVA百科not asking for a full solution of course but if you could point me in the right direction for what to use to build up the grid which will allow me paint colours into it and then output it.
Any help much appreciated, thanks.
here is a somewhat general idea:
depending on the application, i'd use a simple picturebox, load a bitmap (from file, db, create empty, ...) and handle mouse clicks on that ...
translate the screen coordinates to your 16x16 matrix, and use some "needle-scheme" to interact with that image (means you have some sort of colorpicker that selects the color to use, and a click on a pixel sets it to that color)
since your image is only 16x16 you will probably want to set the picturebox to stretch or zoom mode
output of an image object is rather simple if you make use of the System.Drawing.Image class
if you need further details/help, let me know...
精彩评论