CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: FontSize in ListBoxes

  1. #1
    Join Date
    Dec 2014

    FontSize in ListBoxes [RESOLVED]

    In VB5 I have two (let's say, to simplify my question) ListBoxes, call them A and B.
    They both contain exactly and always 21 elements, all in the visible zone, no scrolling necessary.
    They necessarily use different fonts: A is Arial, and B is Symbol.
    I have two wishes:
    (1) The elements in their displays, side by side, should line up together, 0 with 0, 1 with 1,...20 with 20.
    (2) The lists should use the largest FontSize(s) possible (i.e. with all elements visible) in the Height allotted to them, on any size of screen.
    Regarding wish (1), FYI, if I give them both the same FontSize, with some sizes they match and with others they don't. The matchup is good only for sizes 8, 7, 5, and possibly 3 (too small to be sure). For sizes 9, 10, 11, 12, and presumably up, as well as for 4, Symbol is larger than Arial, while for 6, Symbol is smaller than Arial. I would be willing to replace Arial with another not-too-stylized font if you know of one that matches Symbol in size more consistently.
    Regarding wish (2), I'm testing them on two different monitors, with ScreenHeights respectively 9,216 and 10,800, and would like to display them as large as possible on both (or others) without falling off the screen.
    Any ideas for making all this happen within the resources of VB5?

    I said "They necessarily use different fonts: A is Arial, and B is Symbol."
    Well, it turns out, not necessarily. I had chosen Symbol only because its "+" sign and its "-" sign are of equal width. In most fonts, the hyphen is much narrower than the plus sign. But there are several in which they are equal (and the typeface is not too stylized). So I'm using @MS PGothic for both. Case closed.
    Last edited by leezinho; December 23rd, 2017 at 02:26 PM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)