从磁盘读取一个图片文件,存入picturebox,要求图片随picturebox的大小而改变,然后将图片文件以一种格式存入sql数据库。谢谢。

解决方案 »

  1.   

    this.img.Height = 285;
    this.img.Width = 300;
    string path = CreateFile();
    if(path != "")
    {
    Bitmap bp = new Bitmap(path);
    if(bp.Height <= 285)
    this.img.Height = bp.Height;
    if(bp.Width <= 300)
    this.img.Width = bp.Width;
    }
      

  2.   

    要求图片随picturebox的大小而改变,这个设置一下picturebox的属性就可以了
    写入数据库可以看孟子的
    http://dotnet.aspx.cc/ShowDetail.aspx?id=2A5DD7C6-A45A-48AB-A2E8-342A29F17506
      

  3.   

    this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;