public void Execute() { //Set ending location for drawing the shapes int x = (int)Math.Min(x1, X2); //Om **Maxime's** bug te voorkomen int y = (int)Math.Min(y1, Y2); //Om **Maxime's** bug te voorkomen int w = (int)Math.Max(x1, X2) - x; //Om **Maxime's** bug te voorkomen int h = (int)Math.Max(y1, Y2) - y; //Om **Maxime's** bug te voorkomen //Move shape into its correct place System.Drawing.Point pos = new System.Drawing.Point(x, y); invoker.MainWindow.SetCanvasOffset(pos, shape); canvShape.SetPosition(pos); shape.Width = w; shape.Height = h; capDecorator?.Draw(); //Update group structure to represent added shape invoker.UpdateGroups(); }