// reverse colors private void button3_Click(object sender, EventArgs e) { Graphics g = pan.CreateGraphics(); string fname = "c:\\flag.gif"; Bitmap bmp = new Bitmap(fname); Bitmap bmpMem = new Bitmap(bmp.Width,bmp.Height); Graphics gMem = Graphics.FromImage(bmpMem); gMem.DrawImage(bmp,0,0); / / Draw flag to memory
Color cnRed = Color.FromArgb(255,214,41,33); for (int y=0; y 240) bmpMem.SetPixel(x,y, cnRed); else bmpMem.SetPixel(x,y,Color.White); } } g.DrawImage(bmpMem,0,0); // Display reversed flag on panel gMem.Dispose(); g.Dispose(); }
// draw image void button1_Click(object sender, EventArgs e) { Graphics g = pan.CreateGraphics(); string fname = "c:\\flag.gif"; Bitmap bmp = new Bitmap(fname); g.DrawImage(bmp,0,0); g.Dispose(); }
|