
C#使用GDI+绘制图形,出现下面的错误,是什么原因呀?? 5
protectedoverridevoidOnPaint(PaintEventArgse){Bitmapmybitmap=newBitmap(@"\StorageCard...
protected override void OnPaint(PaintEventArgs e)
{
Bitmap mybitmap = new Bitmap(@"\Storage Card\2.jpg");
Graphics g = this.pictureBox1.CreateGraphics();
g.DrawImage(mybitmap, 20, 20);
}
报错An unhandled exception of type 'System.NotSupportedException' occurred in System.Drawing.dll
Additional information: NotSupportedException 展开
{
Bitmap mybitmap = new Bitmap(@"\Storage Card\2.jpg");
Graphics g = this.pictureBox1.CreateGraphics();
g.DrawImage(mybitmap, 20, 20);
}
报错An unhandled exception of type 'System.NotSupportedException' occurred in System.Drawing.dll
Additional information: NotSupportedException 展开
2个回答
展开全部
Bitmap mybitmap = new Bitmap(@"\Storage Card\2.jpg");
应该是:Bitmap mybitmap = (BItmap)Image.FromFIle(@"\Storage Card\2.jpg");
g.DrawImage(mybitmap, 20, 20);
少参数
应该是:Bitmap mybitmap = (BItmap)Image.FromFIle(@"\Storage Card\2.jpg");
g.DrawImage(mybitmap, 20, 20);
少参数
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询