Click here to Skip to main content
13,052,696 members (66,182 online)
Rate this:
Please Sign up or sign in to vote.
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 24-Nov-12 13:49pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100