I am trying to make my UserControl with custom borders (I changed default border style to "none" in properties - I created control and I am invoking Graphics.DrawRectangle(...,ClientRectangle). And what I see is only the top and left borders of my painted rectangle - it seems that real size of the area where I can draw is different than ClientRectangle... How to change it / get the right ClientRectangle size?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
ClientRectangle returns the rectangle in exclusive coordinates so you need to subtract 1 from the bottom and right hand sides. This will work regardless of how many units per pixel there are in the current graphics mode, someone correct me if I am wrong.