home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / mswindo / programm / misc / 3495 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.7 KB

  1. Path: sparky!uunet!lax.pe-nelson.com!lax!twbrown
  2. From: twbrown@PE-Nelson.COM (Tom W. Brown)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Listbox help needed
  5. Message-ID: <694@lax.lax.pe-nelson.com>
  6. Date: 17 Nov 92 22:36:37 GMT
  7. References: <1992Nov16.174241.1@cortex>
  8. Sender: news@lax.pe-nelson.com
  9. Organization: PE-Nelson
  10. Lines: 27
  11.  
  12. In article <1992Nov16.174241.1@cortex>, mboucher@cortex.prospect.com (Mike Boucher) writes:
  13. |> 1) I have defined a listbox in a dialog resource file, using courier 9 as the
  14. |>   font.  When I GetTextMetrics, I get the information for the system font.
  15. |>   Any ideas why? What do I have to do to get the right font info?
  16.  
  17. You need to do a GetTextMetrics() with a DC that has a Courier 9 font
  18. selected.  Use CreateFont() to get an appropriate font, SelectObject() to
  19. get it into a DC, and then use GetTextMetrics() to obtain font information.
  20. Be sure and select the original font back and delete the created font.
  21.  
  22.  
  23. |> 2) Any ideas on how to get the maximum number of items which would be VISIBLE
  24. |>   in the list box?
  25.  
  26. Assuming that items in the listbox have a fixed height you can divide the
  27. height of the listbox window by the height of a single item.  The former
  28. is obtained through GetClientRect() with the window handle of the listbox.
  29. The latter can be had by sending the LB_GETITEMHEIGHT message to the
  30. list.
  31.  
  32.  
  33.  
  34. ----------------------------------------------------------------------------
  35. Tom Brown               |  "'ow d'you know 'e's a king?
  36. PE Nelson Systems       |            'cause 'e 'asn't got shit all over 'im!"
  37. twbrown@pe-nelson.com   |                    Monty Python and the Holy Grail
  38. ----------------------------------------------------------------------------
  39.