如题,其实就是我想得到用鼠标左键点击并拖拉一段距离后得到的那个矩形,谢谢大家了!

解决方案 »

  1.   

    忘记说了,大家可能不理解是什么意思,其实我就是要得到一个rectangle对象
      

  2.   

    Rectangle 指定了坐标空间中的一个区域,通过 Rectangle 对象的左上顶点的坐标(x,y)、宽度和高度可以定义这个区域。 Rectangle 对象的 width 和 height 是 public 字段。创建 Rectangle 的构造方法,以及可以修改该对象的方法,都不会禁止将 width 或 height 设置为负值。 如果 Rectangle 的 width 或 height 为负值,则认为 Rectangle 为空。如果 Rectangle 为空,则 isEmpty 方法将返回 true。空 Rectangle 中不包含任何点,或者说其内部没有任何点。但是,width 和 height 的值仍然有效。空 Rectangle 在坐标空间中仍有一个位置,改变其大小或位置的方法仍然有效。如果任何参与操作的 Rectangle 对象有一个负的 width 或 height,则对过个 Rectangle 进行操作的方法的行为是不确定的。这些方法包括 intersects、intersection 和 union。