protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        Image2.Width = Image2.Width * 1.2;
        Image2.Height = Image2.Height * 1.2;
    }运行显示
编译器错误信息: CS0019: 运算符“*”无法应用于“System.Web.UI.WebControls.Unit”和“double”类型的操作数  请问我是事件里应该怎么写?
谢谢大家!

解决方案 »

  1.   

    Image2
     这个是什么控件
     我写的 可以存放图片的控件是pictureBox             pictureBox1.Width = pictureBox1.Width * 2;
                pictureBox1.Height = pictureBox1.Height * 5;
     这个完全是可以的!
      

  2.   

            Image1.Height = new Unit(Image1.Height.Value * 1.5);
            Image1.Width = new Unit(Image1.Width.Value * 2.5);
      

  3.   

      
      Image2.Height = new Unit(Image2.Height.Value * 1.2);
      Image2.Width = new Unit(Image2.Width.Value * 1.2);可以实现你说的效果
      

  4.   

    可以先用Convert.ToInt32强制转换一下,总之来回转换就行了,我只会这样