Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Centering tooltip text within a window


  • Please log in to reply
2 replies to this topic
deanhill1971
  • Members
  • 58 posts
  • Last active: Dec 17 2011 02:42 AM
  • Joined: 30 Sep 2005
Is there a simple way to center the text of a tooltip within a window?

I have code to calculate the center of the window. However, if the tooltip is, "This is my tooltip to display.", then "This" is put in the center, and the remaining text is right of center. I want the center of the text string put in the center of the window.

My only thought is to somehow calculate the pixel length of the tooltip, but I'm not sure how to do that. I'm not sure how Windows determines what font and font size to use for a tooltip either.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Tooltip is a Window :

Tooltip, The Quick Brown Fox Jumps Over The Lazy Dog!, 10,10
WinGetPos, X,Y,W,H, [color=red]ahk_class tooltips_class32[/color]
MsgBox, 64, Size of the Tooltip Window, % X "-" Y "-" W "-" H

:)

deanhill1971
  • Members
  • 58 posts
  • Last active: Dec 17 2011 02:42 AM
  • Joined: 30 Sep 2005
Sweet. That works.

Thanks Skan.