Original Post
🔒 Locked
string width in pixels
Advertisement
I''ve used GetTextExtentPoint in the past. It will return both the width and the height of a string based upon the currently selected font of a DC.
But, there''s a tooltip window class that you can use as well with CreatWindowEx. You don''t have to size its window at all as the window class proc will handle it for you (it resizes the window to the appropriate size when the tooltip window is displayed). The class is TOOLTIPS_CLASS. Do a search for this in MSDN and you should find a page that''s helpful in setting up such a window. Or, I have code if you''d like?
But, there''s a tooltip window class that you can use as well with CreatWindowEx. You don''t have to size its window at all as the window class proc will handle it for you (it resizes the window to the appropriate size when the tooltip window is displayed). The class is TOOLTIPS_CLASS. Do a search for this in MSDN and you should find a page that''s helpful in setting up such a window. Or, I have code if you''d like?
quote:
Original post by Darrell L
But, there''s a tooltip window class that you can use as well with CreatWindowEx. You don''t have to size its window at all as the window class proc will handle it for you (it resizes the window to the appropriate size when the tooltip window is displayed). The class is TOOLTIPS_CLASS. Do a search for this in MSDN and you should find a page that''s helpful in setting up such a window. Or, I have code if you''d like?
That I know. The fact is - the
rect member in the TOOLINFO struct requires a rect into which the tooltip is accommodated. If the specified rectangle is not big enough, it seems the tooltip is not displayed. Hence - I need to calculate the size of the rectangle from the string passed to the tooltip as the "tool tip".quote:
I''ve used GetTextExtentPoint in the past. It will return both the width and the height of a string based upon the currently selected font of a DC.
Thanks! Looks like that''s what I''m looking for - gonna try it out soon.
Crispy
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement