Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. from Font Name and Font Size ==> TextWidth and Textheight ??

from Font Name and Font Size ==> TextWidth and Textheight ??

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aa_zz
    wrote on last edited by
    #1

    hi everybory. I using VC++6.0. if I have font name and font size of text => text height and text width ? hope everybody help for me. thanks very much.

    nothing

    _ 1 Reply Last reply
    0
    • A aa_zz

      hi everybory. I using VC++6.0. if I have font name and font size of text => text height and text width ? hope everybody help for me. thanks very much.

      nothing

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You can use the GetTextMetrics[^] function to get the font height and width. First get a handle to the font using CreateFont[^] or CreateFontIndirect[^]. Then create a device context using GetDC[^] and select the font into the device context using SelectObject[^]. Now you can use GetTextMetrics on the device context handle.

      «_Superman_» I love work. It gives me something to do between weekends.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups