首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

pictureBox显示有关问题

2012-04-16 
pictureBox显示问题请问Bitmap myBitmap new Bitmap(apfPath)Graphics g pBShowPicture.CreateGraphi

pictureBox显示问题
请问 Bitmap myBitmap = new Bitmap(apfPath);
  Graphics g = pBShowPicture.CreateGraphics();
  //放大 
  Rectangle expansionRectangle = new Rectangle(400, 10, myBitmap.Width * 2, myBitmap.Height * 2);
  g.DrawImage(myBitmap, expansionRectangle);


这些代码怎么不管用,是不是我没把绘完的图显示在pictureBox中, 如何显示? 谢谢。

[解决办法]
Bitmap myBitmap = new Bitmap(@"C:\Users\SaeWind\Desktop\123\1.png");
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{

Graphics g = e.Graphics;
//放大
Rectangle expansionRectangle = new Rectangle(10, 10, myBitmap.Width * 2, myBitmap.Height * 2);
g.DrawImage(myBitmap, expansionRectangle);

}

热点排行