Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

c# - 无法从索引像素格式创建再现图形对象(Reproducing Graphics Object Cannot be Created from Indexed Pixel Format)

I'm trying to reproduce ' https://www.c-sharpcorner.com/article/solution-for-a-graphics-object-cannot-be-created-from-an-im/ '

(我正在尝试复制' https://www.c-sharpcorner.com/article/solution-for-a-graphics-object-can-be-be-created-from-an-im/ ')

I'm trying to create and save a Bitmap with Pixel Format set to Dont care ,but i keep getting Parameter not valid exception.

(我正在尝试创建和保存像素格式设置为“不Dont care的位图,但是我一直在获取“ Parameter not valid异常。)

            Bitmap orig = new Bitmap(500,500);
            Bitmap clone = new Bitmap(orig.Width, orig.Height,
                System.Drawing.Imaging.PixelFormat.DontCare);

            using (Graphics gr = Graphics.FromImage(clone))
            {
                gr.DrawImage(orig, new Rectangle(0, 0, clone.Width, clone.Height));
            }
            clone.Save("test.png");
  ask by techno translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...