Simon Mourier's Avatar
Simon Mourier's blog (1346 answers on StackOverflow) about Microsoft technologies C#, C/C++, .NET, WinRT, WinUI, COM, Interop, DirectX, Direct2D, Windows, ...
  • 🔎︎ Search
  • Categories
  • Archives
  • About Me
  • c#
  • graphics
  • imaging

c# drawing, circle goes outside form

Dec 11, 2018 See the question and my original answer on StackOverflow

It's because you use the Window size, not the "client" size. Just replace your code by this:

gr.DrawEllipse(ellipse_pen, this.ClientRectangle);

The client area of a control is the bounds of the control, minus the nonclient elements such as scroll bars, borders, title bars, and menus.

  • SmoBlog © 2010-2025 Simon Mourier. All rights reserved.
  • Privacy & Terms