Article View: comp.os.ms-windows.programmer.misc
Article #2101Re: Listbox help needed
From: Tom W. Brown
Date: Tue, 17 Nov 1992 22:36
Date: Tue, 17 Nov 1992 22:36
27 lines
1768 bytes
1768 bytes
In article <1992Nov16.174241.1@cortex>, mboucher@cortex.prospect.com (Mike Boucher) writes: |> 1) I have defined a listbox in a dialog resource file, using courier 9 as the |> font. When I GetTextMetrics, I get the information for the system font. |> Any ideas why? What do I have to do to get the right font info? You need to do a GetTextMetrics() with a DC that has a Courier 9 font selected. Use CreateFont() to get an appropriate font, SelectObject() to get it into a DC, and then use GetTextMetrics() to obtain font information. Be sure and select the original font back and delete the created font. |> 2) Any ideas on how to get the maximum number of items which would be VISIBLE |> in the list box? Assuming that items in the listbox have a fixed height you can divide the height of the listbox window by the height of a single item. The former is obtained through GetClientRect() with the window handle of the listbox. The latter can be had by sending the LB_GETITEMHEIGHT message to the list. ---------------------------------------------------------------------------- Tom Brown | "'ow d'you know 'e's a king? PE Nelson Systems | 'cause 'e 'asn't got shit all over 'im!" twbrown@pe-nelson.com | Monty Python and the Holy Grail ----------------------------------------------------------------------------
Technical Details
Message-ID:
<694@lax.lax.pe-nelson.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrownReferences:
<1992Nov16.174241.1@cortex>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown From: twbrown@PE-Nelson.COM (Tom W. Brown) Newsgroups: comp.os.ms-windows.programmer.misc Subject: Re: Listbox help needed Message-ID: <694@lax.lax.pe-nelson.com> Date: 17 Nov 92 22:36:37 GMT References: <1992Nov16.174241.1@cortex> Sender: news@lax.pe-nelson.com Organization: PE-Nelson Lines: 27