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. Border size

Border size

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helptutorial
4 Posts 3 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.
  • C Offline
    C Offline
    caykahve
    wrote on last edited by
    #1

    Hello, How can I detect the border sizes of an MFC dialog? I want to draw something on the dialog bar. First I resize the dialog to some run-time detected size. Then I want to re-position and redraw some controls inside accordingly. The upper boundary is OK since the first pixel of the dialog is defined as (0,0) for the client. But for example, if I click on the leftmost pixel (or convert it with ScreenToClient() since I know the start point of the dialog) of the left border I get (-3,y) as the client value. Then I can say that the thickness of the vertical border of the dialog is 3. Can I be sure that the lower border thickness is the same as the vertical ones? Or is there some function to diagnose it (regarding that it will change w.r.t. your Windows settings)? I would appreciate any help :~ Thanks in advance caykahve

    R V 2 Replies Last reply
    0
    • C caykahve

      Hello, How can I detect the border sizes of an MFC dialog? I want to draw something on the dialog bar. First I resize the dialog to some run-time detected size. Then I want to re-position and redraw some controls inside accordingly. The upper boundary is OK since the first pixel of the dialog is defined as (0,0) for the client. But for example, if I click on the leftmost pixel (or convert it with ScreenToClient() since I know the start point of the dialog) of the left border I get (-3,y) as the client value. Then I can say that the thickness of the vertical border of the dialog is 3. Can I be sure that the lower border thickness is the same as the vertical ones? Or is there some function to diagnose it (regarding that it will change w.r.t. your Windows settings)? I would appreciate any help :~ Thanks in advance caykahve

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      See GetSystemMetrics(). /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

      C 1 Reply Last reply
      0
      • C caykahve

        Hello, How can I detect the border sizes of an MFC dialog? I want to draw something on the dialog bar. First I resize the dialog to some run-time detected size. Then I want to re-position and redraw some controls inside accordingly. The upper boundary is OK since the first pixel of the dialog is defined as (0,0) for the client. But for example, if I click on the leftmost pixel (or convert it with ScreenToClient() since I know the start point of the dialog) of the left border I get (-3,y) as the client value. Then I can say that the thickness of the vertical border of the dialog is 3. Can I be sure that the lower border thickness is the same as the vertical ones? Or is there some function to diagnose it (regarding that it will change w.r.t. your Windows settings)? I would appreciate any help :~ Thanks in advance caykahve

        V Offline
        V Offline
        Vitaly Tomilov
        wrote on last edited by
        #3

        "(GetWindowRect - GetClientRect)/2" Professional C++ libraries for getting images from any TWAIN or DirectShow compatible device on www.neatcpp.com

        1 Reply Last reply
        0
        • R Ravi Bhavnani

          See GetSystemMetrics(). /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

          C Offline
          C Offline
          caykahve
          wrote on last edited by
          #4

          Thanks! How I exactly got the border:

          int HBorder = GetSystemMetrics(SM_CXDLGFRAME);
          int VBorder = GetSystemMetrics(SM_CYDLGFRAME); //Left border thickness is equal to right border
          int CaptionHeight = GetSystemMetrics(SM_CYCAPTION);
          int UpperBorder = CaptionHeight + HBorder;

          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