Hi James,
Don't you post this question two times before?
Nicholas Paldino answer to it tomorrow.
I can only give you a sample:
// Windows Application - project
// 2 x Button
// 1 x PictureBox (anchor it L-T-R-B for resizing)
// 1 x SaveFileDialog
// add these methods as a buttons Click handlers!
private void button1_Click(o bject sender, System.EventArg s e) {
// here bmp with 1bpp is created
Bitmap bmp=new Bitmap(pictureB ox1.ClientSize. Width
, pictureBox1.Cli entSize.Height
, System.Drawing. Imaging.PixelFo rmat.Format1bpp Indexed);
if( pictureBox1.Ima ge!=null ) {
Image img=pictureBox1 .Image;
pictureBox1.Ima ge=null;
img.Dispose();
}
pictureBox1.Ima ge=bmp;
}
private void button2_Click(o bject sender, System.EventArg s e) {
Image img=pictureBox1 .Image;
if( img!=null ) {
saveFileDialog1 .DefaultExt="pn g";
if( saveFileDialog1 .ShowDialog(thi s)==DialogResul t.OK ) {
try {
// here this bmp is saved as a PNG 1bpp image
img.Save(saveFi leDialog1.FileN ame
, System.Drawing. Imaging.ImageFo rmat.Png);
}
catch(Exception ex) {
MessageBox.Show ("Save error: "+ex.Messag e);
}
}
}
else {
MessageBox.Show ("There's no image to save!");
}
}
Regards
Marcin
I have read that you can create a 1bpp png image but has anyone any idea
how to do it?......
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!