title: How to increase thickness of shape in WPF
body: <p>I'm trying to create a Paint Application in WPF using Canvas. I want to increase the thickness of my shape while drawing so I try increasing StrokeThickness.</p>
  
  <p>This is how I want it to be: </p>
  
  <p><a href="https://i.stack.imgur.com/82c3I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/82c3I.png" alt="enter image description here"></a></p>
  
  <p>And this is what I get:</p>
  
  <p><a href="https://i.stack.imgur.com/DUAve.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DUAve.png" alt="enter image description here"></a></p>
  
  <p>As you can see the outline only extends inside the boundary. How can I make it extends on both side?</p>
  
  <p>Here is my code:</p>
  
  <p>In MouseDown Event:</p>
  
  <pre><code> Rectangle rect = new Rectangle();
   rect.Stroke = _color;
   rect.StrokeThickness = _size;
   Canvas.SetLeft(rect, _startPoint.X);
   Canvas.SetTop(rect, _startPoint.Y);
   cv_PaintBoard.Children.Add(rect);
   isDrawing = true;
  </code></pre>
  
  <p>In MouseMove Event:</p>
  
  <pre><code>if (isDrawing == true &amp;&amp; e.LeftButton == MouseButtonState.Pressed)
  {
      Canvas canvas = (Canvas)sender;
  
      Rectangle rect = canvas.Children.OfType&lt;Rectangle&gt;().LastOrDefault();
  
      if (rect != null)
      {
          Point endPoint = e.GetPosition((IInputElement)sender);
          Point startPoint = new Point(
              Math.Min(endPoint.X, _startPoint.X),
              Math.Min(endPoint.Y, _startPoint.Y)
              );
  
          rect.Width = Math.Max(endPoint.X, _startPoint.X) - startPoint.X;
          rect.Height = Math.Max(endPoint.Y, _startPoint.Y) - startPoint.Y;
  
          Canvas.SetLeft(rect, startPoint.X);
          Canvas.SetTop(rect, startPoint.Y);
      }
  }
  </code></pre>