/// <include file='doc\Bitmap.uex' path='docs/doc[@for="Bitmap.SetPixel"]/*' /> /// <devdoc> /// <para> /// Sets the color of the specified pixel in this <see cref='System.Drawing.Bitmap'/> . /// </para> /// </devdoc> public void SetPixel(int x, int y, Color color) { if ((PixelFormat & PixelFormat.Indexed) != 0) { throw new Exception(SR.GetString(SR.GdiplusCannotSetPixelFromIndexedPixelFormat)); } int status = SafeNativeMethods.GdipBitmapSetPixel(new HandleRef(this, nativeImage), x, y, color.ToArgb()); if (status != SafeNativeMethods.Ok) { throw SafeNativeMethods.StatusException(status); } }