Rectangle rec=new Rectangle(imgLeft1,imgTop1,(int)imgWidth1,(int)imgHeight1);
里面的参数 只能是int

解决方案 »

  1.   

    确定了 图片在form上的
    (imgLeft,imgTop,imgWidth,imgHeight);
    这4个参数应该没有问题了啊
      

  2.   

    确定了 图片在form上的
    (imgLeft,imgTop,imgWidth,imgHeight);
    这4个参数应该没有问题了啊这样不行 这只能画水平放置的矩形 而我需要任意角度的
      

  3.   

    double onacross = Math.Sqrt(RectAllStru.la[i]*RectAllStru.la[i]+RectAllStru.sa[i]*RectAllStru.sa[i])/2;
    double angle_1 = RectAllStru.Alpha[0,i];
    double angle_2 = Math.Acos((2*onacross*onacross-RectAllStru.la[i]*RectAllStru.la[i])/(2*onacross*onacross));
    double angle_3 = Math.Acos((2*onacross*onacross-RectAllStru.sa[i]*RectAllStru.sa[i])/(2*onacross*onacross)); Point point1 = new Point((int)CorChange(1,RectAllStru.rbase[i],RectAllStru.cx[0,i]+onacross*Math.Cos(angle_1)),(int)CorChange(2,RectAllStru.rbase[i],RectAllStru.cy[0,i]+onacross*Math.Sin(angle_1)));
    Point point2 = new Point((int)CorChange(1,RectAllStru.rbase[i],RectAllStru.cx[0,i]+onacross*Math.Cos(angle_1+angle_2)),(int)CorChange(2,RectAllStru.rbase[i],RectAllStru.cy[0,i]+onacross*Math.Sin(angle_1+angle_2)));
    Point point3 = new Point((int)CorChange(1,RectAllStru.rbase[i],RectAllStru.cx[0,i]+onacross*Math.Cos(angle_1+angle_2+angle_3)),(int)CorChange(2,RectAllStru.rbase[i],RectAllStru.cy[0,i]+onacross*Math.Sin(angle_1+angle_2+angle_3)));
    Point point4 = new Point((int)CorChange(1,RectAllStru.rbase[i],RectAllStru.cx[0,i]+onacross*Math.Cos(angle_1+2*angle_2+angle_3)),(int)CorChange(2,RectAllStru.rbase[i],RectAllStru.cy[0,i]+onacross*Math.Sin(angle_1+2*angle_2+angle_3))); Point[] curvePoints = {point1,point2,point3,point4}; dc.DrawPolygon(BlackPen,curvePoints);注:其实int的影响并不大,我试过了,可以忽略