Announcement

Collapse
No announcement yet.

Adding text numbers to icons on the fly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding text numbers to icons on the fly

    Is it possible to create a icon in 32x32 or 16x16 and store it in the resource file. Then when it comes time to use it in a treeview for example, is it possible to add a text number and center it in the icon itself.

    Being lazy, I'm trying to avoid creating 1-32 exact icons whose only difference is the number (menu number in this case).

    Bob Mechler

  • #2
    http://msdn.microsoft.com/en-us/library/ms997538.aspx

    Comment


    • #3
      > 1-32 exact icons whose only difference is the number (menu number in this case

      Um, I think you only need ten (10) icons, "0" thru "9"

      To make a "32" you put a "3" next to a "2"

      But seriously....

      Make your control as a registered window class with a CreateBrush() or CreatePatternBrush() as the WndClassEx.hBrBackGround, then on WM_PAINT select some cool font into the hDC and DrawText() the number in the center!

      OR...

      I can't believe "someone" has not made up a set of "digit" icons/bmps or something you can download for free.

      That is, it doesn't have to BE an icon, it just has to LOOK LIKE an icon!

      BTW, thanks for your starter "Send Email via Outlook via COM" code I found here. It's what I used in a customer application, and will soon be posting a simplified for demo here (showing how to include attachments).

      MCM
      Last edited by Michael Mattias; 27 Oct 2009, 06:13 PM.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        If you are supposed to click on these things.... sounds like "the place" for an "owner-drawn" button control......

        (I notice in another thread you are currently all enthused re owner-drawn listbox.... well, here is the GOLDEN OPPORTUNITY to see what you've learned about owner-drawing!!!)
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          I am not sure but these controls should allow mask stuff.
          Like the shortcut (arrow) symbol for a file.

          So maybe you'll need 32 icons but in an imagelist shown above an ordinary image.

          You can always resort to ownerdraw stuff though.
          hellobasic

          Comment


          • #6
            Also.. you can use a bitmap image list for the images and draw such an image to a new DC/bitmap with numbers and replace it in the imagelist.
            hellobasic

            Comment

            Working...
            X