

"C:\Documents and Settings\All Users\Documents\My Music\music.bmp", _ Private Sub Button1_Click(ByVal sender As System.Object, _īyVal e As System.EventArgs) Handles Button1.Click Private void Button1_Click(System.Object sender, System.EventArgs e)Ĭolor pixelColor = image1.GetPixel(x, y) Ĭolor newColor = Color.FromArgb(pixelColor.R, 0, 0) Label1->Text = String::Format( "Pixel format: ", image1->PixelFormat ) Set the PictureBox to display the image. Loop through the images pixels to reset color.Ĭolor pixelColor = image1->GetPixel( x, y ) Ĭolor newColor = Color::FromArgb( pixelColor.R, 0, 0 ) Image1 = gcnew Bitmap( "C:\\Documents and Settings\\All Users\\" Void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) Paste the code into the form and associate the Button1_Click method with the button's Click event. This example is designed to be used with a Windows Forms that contains a Label, PictureBox, and Button named Label1, PictureBox1, and Button1, respectively. It also uses the PixelFormat, Width, and Height properties.

The following code example demonstrates how to construct a new Bitmap from a file, using the GetPixel and SetPixel methods to recolor the image.

ComVisibleAttribute SerializableAttribute Examples
