Re: Calculate the interior of a rectangle



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


.



Relevant Pages

  • Re: Calculate the interior of a rectangle
    ... There will be additional drawing done within the bounds of the ... If the user redefines the border of the bounding ... the specified X,Y coordinates of the rectangle. ... All Programs/Accessories/Accessibility) and changing the DrawWidth a few ...
    (microsoft.public.vb.general.discussion)
  • Re: Calculate the interior of a rectangle
    ... There will be additional drawing done within the bounds of the ... If the user redefines the border of the bounding ... the specified X,Y coordinates of the rectangle. ... All Programs/Accessories/Accessibility) and changing the DrawWidth a few ...
    (microsoft.public.vb.general.discussion)
  • Re: Calculate the interior of a rectangle
    ... There will be additional drawing done within the bounds of the ... If the user redefines the border of the bounding ... the specified X,Y coordinates of the rectangle. ... the location of the bounding rect and it's borderwidth. ...
    (microsoft.public.vb.general.discussion)
  • Calculate the interior of a rectangle
    ... I have a function which draws a rectangle with a user defined border. ... There will be additional drawing done within the bounds of the ... the pen is an odd number of pixels. ...
    (microsoft.public.vb.general.discussion)
  • Re: dashed line not displaying
    ... border to border. ... I ended up just drawing a line with the ... Yeah, sometimes Visio has a mindlessness about it, and believes your ... All three versions have solid line result: enhanced metafile, ...
    (microsoft.public.visio.general)