Re: Caption Height

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"expvb" <nobody@xxxxxxx> wrote in message
news:%23$22bqqdJHA.5904@xxxxxxxxxxxxxxxxxxxxxxx
"David Youngblood" <dwy@xxxxxxxxx> wrote in message
news:OpS2rLqdJHA.4684@xxxxxxxxxxxxxxxxxxxxxxx
26, and yes I have considered that. But that assumes a border at the top
and bottom of the form (width - scalewidth = 2 times frame thickness).
That doesn't appear to be the case for a themed window. The caption has
rounded corners so drawing a top border will not work. Also, looking at
the themed window part ID's there are parts for left frame, right frame
and bottom frame, but no top frame part.

That might be what I end up doing, adding caption height + 1 frame width.
For the not themed window, I am already subtracting border width (1
pixel) from the value returned by GetSystemMetrics. I'm just trying to
find "correct" formula, if one exists.

This code asks Windows what is the top left (0,0) corner positions in
pixels relative to the screen, then subtract the result from the upper
left corner of the window, including the title bar. This gets the actual
border size. In my case with XP default theme, your code printed the
following(With BoderStyle of Form1 set to the default "2 - Sizable"):

Using GetThemePartSize, caption height = 29
Using GetSystemMetrics, caption height = 26

Larry's code printed the following:

Border: 60 (Twips) = 4 (Pixels)
TitleBar: 390 (Twips) = 26 (Pixels)

Strangely I expected Larry's method to work and it does when I converted
everything to pixels first as shown here:

Larry's example subtracted two border widths which is why it returned 26
rather than 30.

Your posted code returns the correct value. But (isn't there always a but),
I need (want) to draw a caption on a caption-less window. In this case the
code returns 0. I might could query an external form, but would rather avoid
that. The system should be able to tell me the correct height.

David



.



Relevant Pages

  • Re: Caption Height
    ... corners so drawing a top border will not work. ... window part ID's there are parts for left frame, ... For the not themed window, I am already subtracting border width ... Private Function PFmt(ByRef Vlu As Long) As String ...
    (microsoft.public.vb.winapi)
  • Re: Arcane Question @ Text Boxes & "Frames"
    ... Insert | Caption with a floating object selected, Word puts the ... caption in a text box (you'll need to either convert that to a frame or pull ... insert both figure and caption in a single frame). ... Both frames and text boxes have a border by default. ...
    (microsoft.public.word.pagelayout)
  • Re: Insert pictures - caption query
    ... as if your caption paragraph has somehow acquired a border. ... > Frame to place it against the right margin or wherever ... ... > have just been trying to select and move the picture only. ...
    (microsoft.public.word.docmanagement)
  • Re: Arcane Question @ Text Boxes & "Frames"
    ... caption in a text box (you'll need to either convert that to a frame or pull ... insert both figure and caption in a single frame). ... Both frames and text boxes have a border by default. ... page, column, margin, paragraph), but their wrapping limited to None ...
    (microsoft.public.word.pagelayout)
  • Re: Lost Captions, Out of Sequence Captions, ...
    ... or for any other purpose) and you cannot insert a text box in a frame. ... is I still have one caption inside a textbox, ... a textbox with a caption in it. ... Do not remove the border from the Frame yet. ...
    (microsoft.public.word.formatting.longdocs)