Rectangle 类中有两个重载构造函数。
public Rectangle(Point location, Size size);
public Rectangle(int x, int y, int width, int height);
但是Rectangle类中没有构造函数参数new Rectangle([int], [int], [int], [int], [string])。
你可以尝试在类中使用复合public Rectangle rect { get; set; }属性。
然后使用构造函数设置Rectangle对象和Name
public class CustomerRectangle
{
public Rectangle Rect { get; set; }
public string Name { get; set; }
public CustomerRectangle(int llx, int lly, int urx, int ury,string name)
{
Rect = new Rectangle(llx, lly, urx, ury);
Name = name;
}
}
那么你可以使用
CustomerRectangle MyRectangle = new CustomerRectangle (Y, X, Width, Height, Name);
//MyRectangle.Name; use Name property
//MyRectangle.Rect; use Rectangle