void createRegion(double x1, double y1, double theta, double x2, double y2) { if (Drawing_Ob != null) { Drawing_Ob.Dispose(); } Drawing_Ob = HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.RECTANGLE2, x1, y1, theta, x2, y2); Drawing_Ob.SetDrawingObjectParams("color", "green"); Drawing_Ob.OnDrag(getposistion); window.AttachDrawingObjectToWindow(Drawing_Ob); }