Ejemplo n.º 1
0
        public void SetPixel(int x, int y, Color color)
        {
            Status s = GDIPlus.GdipBitmapSetPixel(nativeObject, x, y, color.ToArgb());

            if (s == Status.InvalidParameter)
            {
                // check is done in case of an error only to avoid another
                // unmanaged call for normal (successful) calls
                if ((this.PixelFormat & PixelFormat.Indexed) != 0)
                {
                    string msg = string.Format("SetPixel cannot be called on indexed bitmaps.");
                    throw new InvalidOperationException(msg);
                }
            }
            GDIPlus.CheckStatus(s);
        }