Re: Calculate the interior of a rectangle
- From: "Rick Rothstein \(MVP - VB\)" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
- Date: Mon, 19 Mar 2007 12:08:14 -0400
I have a function which draws a rectangle with a user defined border.
There will be additional drawing done within the bounds of the
original rectangle. If the user redefines the border of the bounding
box I need to move the interior drawing accordingly. The problem I am
having is in attempting to calculate the rectangles 'client area'. I
can not seem to find figure out where the border is drawn relative to
the specified X,Y coordinates of the rectangle.
Can anyone explain the placement of the 'pen'? It seems as though it
is centered on the specified X,Y but that only works when the width of
the pen is an odd number of pixels. Where is the pen placed when it's
width is an even number of pixels?
Using this code
Dim y As Long
For y = 1001 To 9999
Line (1000, y)-(10000, y), QBColor(y Mod 16)
Next
DrawWidth = 4
Line (1000, 1000)-(3000, 1000), vbWhite
in conjunction with the Windows Magnifier tool (located on the Start menu in
All Programs/Accessories/Accessibility) and changing the DrawWidth a few
times to see what is what, it appears that for even DrawWidth values, the
"extra" line is drawn inside the rectangle. One question, though, you say
you have to "move the interior drawing accordingly" depending on the border
width... if the border completely surrounds the drawing, where are you
moving it to?
Rick
.
- Follow-Ups:
- Re: Calculate the interior of a rectangle
- From: Steve
- Re: Calculate the interior of a rectangle
- References:
- Calculate the interior of a rectangle
- From: Steve
- Calculate the interior of a rectangle
- Prev by Date: Re: How do I link a text box on two forms
- Next by Date: Re: How do I link a text box on two forms
- Previous by thread: Calculate the interior of a rectangle
- Next by thread: Re: Calculate the interior of a rectangle
- Index(es):
Relevant Pages
|