Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a custom control that I am making. When I add a border around the control the border goes outside the bounds of the control on the right and bottom side. I thought I once knew a way to prevent the border from doing this, but I no longer remember. Any ideas?
Posted

1 solution

It turns out that the stroke that is drawn by a control actually adds on to the size of the control. So in order to keep my control appear at a constant size no matter what the stroke thickness is, I did the following:

I translated the rendered portion of my control down and to the right by half the stroke thickness.
I decreased both the height and width by the stroke thickness.

So far this seems to have solved my problem!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900