解决图片缩放问题。我这段代码,只能按所选图片的大小截取,虽然图片画布大小改了但是实质上图片并没有进行缩放。怎样让图片的大小改变,不用手工调整图片大小后再截取。
public void SaveScreen(string strPicName)
{

bmp=(Bitmap) this.pbShow.Image; //图片框中所显示的图
bmp1 = new Bitmap(iWidth,iHeight,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
g = Graphics.FromImage(bmp1);
g.DrawImage(bmp,new Rectangle(0,0,iWidth,iHeight),iLeft,iTop,iWidth,iHeight,System.Drawing.GraphicsUnit.Pixel);
bmp1.Save(strSavePath+strPicName,System.Drawing.Imaging.ImageFormat.Jpeg);
}

解决方案 »

  1.   

    bmp可以保存为jpg格式吗?bmp1.Save(strSavePath+strPicName,System.Drawing.Imaging.ImageFormat.Jpeg);应该不行吧
      

  2.   

    picbox的"SizeMode"设成:StretchImage
      

  3.   

    应该可以设置jpg保存时的宽度和高度。
      

  4.   

    <script LANGUAGE="JAVASCRIPT"> 
      function show(chkw) 
        { 
          if(chkw>200) 
            {
             chkw=200;
            }
          else
            {
              chkw=chkw;
             }
       return chkw;
    }</script>//example <img src="images/teach/opera/01.jpg" onload="this.width=show(this.width)" >
      

  5.   

    Sample code as follows:Bitmap bitNew = new Bitmap( oldImage, new Size( nNewWidth, nNewHeight ) );