I am designing a control where the user can specify the X, Y, Width and Height of the DisplayRectangle property in relation to the ClientRectangle.
From what I have read in the MSDN documentation, DisplayRectangle only has a get accessor, and therefore its dimensions cannot be set, however this is imperative in my control!
Can any one suggest how I might safely implement a DisplayRectangle that has both get and set accessors? – or explain why this is bad practice?
Thanks.
TESTS:
-
Set
TabControlstyle toUserPaint, and adjust theAlignmentproperty, TheDisplayRectanglemoves to compensate for the location of the tabs. AssumingTabControlhas a built in mechanism to set the Rectangle bounds. -
Created
DemoControl : Control, paintedClientRectanglein Red, andDisplayRectanglein Blue and tried callingSetDisplayRectLocation(x, y)…not quite what I wanted…and yielded no results!
In order to allow the user to set the bounds of the DisplayRectangle property for a control, I have come up with the following solution: