Re: Lebans Tooltip Control : Listbox font size

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



Are you working with Access 2003? Prior to 2003(I think), the Tooltips class
works correctly for any size font in the ListBox. I cheated a bit to save
time when calculating the font height for a row in the ListBox. It's my
opnly solution that uses this method and now it is biting me in the ass.
Access 2003, when instantiating the ListBox in the form's Load event, does
not bother to select the font into the ListBox's Device Context. Instead it
creates the DC with the default 8 point font. Honestly, I cannot see me
finding time to correct this for a couple of weeks yet.

To work around this, I need to create a DC myself and select the font into
it that matches the control's Font prop's settings.

As it states in the commented source code, you cannot have any partial or
empty rows at the bottom of your ListBox. You have to size your control to
display full rows.

Finally, you can turn off the column header Tooltip by NOT enabling Column
Headers property in your ListBox control. Just place a couple of Lable
controls as pseudo Column Headers(no support for horizontal scrolling
though.)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"Guy" <gjt@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uxYdJKx4HHA.5852@xxxxxxxxxxxxxxxxxxxxxxx
Stephen
Thank you for your prompt response.

I have found this code and inspected var. values on step through.

m_TotalDisplayedRows = 19 - yet the actual list box in question only has
10 displayed rows (excl. column headers).

Note : I have reset the listbox font size to 8 (default) and the tooltip
text is correct for ALL rows - so the font size does appear to be the
problem -for me at least.....

Also, I note the tooltip graphic displays for the column header and all
space below any valid rows in the listbox....? Can this be prevented?

Thanks



"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdot...@xxxxxxxxxxxx>
wrote in message news:%23bVOg0w4HHA.5880@xxxxxxxxxxxxxxxxxxxxxxx
Hi Guy,
it does not matter what Font size you use. Have you looked at my Comments
in the source code for this issue?

' Height of Text
' This is not a perfect solution.
' The first row is not as tall as the rest
' of the rows so we will fudge a bit.
' Also you should have the Listbox's last row
' be completely visible. Finally the ListBox must not have
' any empty rows at the bottom of the Control.
m_HeightSingleRow = pt.cy - 1
' Convert pixels to Twips
m_HeightSingleRow = m_HeightSingleRow * (TWIPSPERINCH /
m_ToolTip.ScreenYdpi)
' Now divide the control's height by the height of one row of Text
m_TotalDisplayedRows = m_ListBox.Height \ m_HeightSingleRow

Let me know how you make out.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"Guy" <gjt@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:eYT5Cww4HHA.5424@xxxxxxxxxxxxxxxxxxxxxxx
I am using the Lebans '97 tooltip control for adding some richer
functionality to a form on my Access database.
However, I appear to have a problem. My endusers tend not have
particuarly good eyesight and so I have increased the default size of
the list items in the listbox for which I want the Tooltips to appear.
This causes the tooltip code lose its relative row position and so its
displays tooltip text for another row. The longer the list - the larger
the error in the no. rows the text is offset.... apart from reverting to
the default font size - is there a fix for this?

Thank you in advance.

Regards
G







.



Relevant Pages

  • Re: Owner drawn listbox
    ... Pass a reference of the listbox to the ... OwnerDrawListBox object, and use the objects Add method for adding items to ... ' Currently if a row is 'special', then the current font is ... Public Sub Add ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Lebans Tooltip Control : Listbox font size
    ... Guy what I mean is that in form Design view, resize the ListBox control so ... to save time when calculating the font height for a row in the ListBox. ... I note the tooltip graphic displays for the column header and all ...
    (microsoft.public.access.forms)
  • Re: Need critical input on this
    ... I looked on the net for changing a font in a resource control had stuff ... Then I created a Listbox in the resource editor ... // Declare old LOGFONT to save just in case I needed it later ...
    (microsoft.public.vc.mfc)
  • Re: Center align text in list box
    ... As Jeff and Jan have already said, you could use a fixed width font and pad with spaces or you could use a different control or you could subclass a standard ListBox to achieve the effect you desire. ... You can easily add code to calculate the pixel width of the string, either using the appropriate API functions or by simply assigning the listBox Font to a spare Picture Box font and using the PictureBox TextWidth function. ...
    (microsoft.public.vb.general.discussion)
  • Re: Lebans Tooltip Control : Listbox font size
    ... Are you suggesting that the listbox has to be 'dynamically sized' at runtime ... save time when calculating the font height for a row in the ListBox. ... you can turn off the column header Tooltip by NOT enabling Column ...
    (microsoft.public.access.forms)