현재 크기를 채우기 위해 제대로 그려지는 사용자 지정 컨트롤을 만들려고합니다. 크기 조정을 위해 ClientRectangle 속성을 사용해야한다는 가정하에 있었지만 클라이언트 사각형의 오른쪽과 아래쪽이 잘리는 것처럼 보입니다.사용자 지정 컨트롤 크기 조정
Rectangle smaller = new Rectangle(5, 5, ClientRectangle.Width - 10, ClientRectangle.Height - 10);
e.Graphics.DrawRectangle(System.Drawing.Pens.Black, smaller);
e.Graphics.DrawRectangle(System.Drawing.Pens.Red, ClientRectangle);
와 추첨 이벤트 핸들러를 산출 작성이 : 나는 컨트롤의 그리기 가능 영역을 얻기 위해 사용한다 무엇
?
가능한 복제본 : http://stackoverflow.com/a/8377709/577417 –
가능한 [FillRectangle 및 DrawRectangle의 픽셀 동작] (http://stackoverflow.com/questions/3147569/pixel-behaviour-of- fillrectangle-and-drawrectangle) –
@Benjamin 가능한 복제본의 대답이 _ 정확 _ 할 것 같습니다. 아래쪽과 오른쪽에서 1이 아닌 2를 빼야합니다. –