我正在嘗試製作一個自定義控件,以正確繪製自己以填充其當前大小。我假設我應該使用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可能重複的答案似乎是最正確的。看來你需要從底部和右側減去2,而不是1。 –