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. Dialog GetClientRect vs RichEdit ClientRect doesnt seem correct

Dialog GetClientRect vs RichEdit ClientRect doesnt seem correct

Scheduled Pinned Locked Moved C / C++ / MFC
cssvisual-studiocomgraphicsdebugging
4 Posts 3 Posters 2 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi I have a richedit control as child control in my modeless dialog. I have populated editcontrol via streamin SF_TEXT with a program listing. I am looking to insert a bullet to specify a breakpoint. After doing some research there were a number of articles about the richedit ole interface. With the bitmap being an ole client. I remember at one time getting this work (had different computer but still had windows 10) regardless just looking back at those articles it seems the ole support would only work with RTF format text. I am now thinking of going back to original API for bitmaps by that I mean BitBlt and or Strechbilt. In my initdialog after creating the rich edit both object via new and creating a HWND via DDX_CONTROL I did a Clientrect on bot the modless dialog box and the richedit control it showed that right variable of the RECT structure for richedit window was 20 pixels less than the right viariable of the parent modeless dialog box. I think those 20 pixels would be enough for me to insert a bullet bmp Yet when eyeballing the output, it seemed the text of the richedit was right up against the frame of the modeless dialog box I think 20 pixels would be something I would notice am I not understanding things correctly thanks

    Richard Andrew x64R L 2 Replies Last reply
    0
    • F ForNow

      Hi I have a richedit control as child control in my modeless dialog. I have populated editcontrol via streamin SF_TEXT with a program listing. I am looking to insert a bullet to specify a breakpoint. After doing some research there were a number of articles about the richedit ole interface. With the bitmap being an ole client. I remember at one time getting this work (had different computer but still had windows 10) regardless just looking back at those articles it seems the ole support would only work with RTF format text. I am now thinking of going back to original API for bitmaps by that I mean BitBlt and or Strechbilt. In my initdialog after creating the rich edit both object via new and creating a HWND via DDX_CONTROL I did a Clientrect on bot the modless dialog box and the richedit control it showed that right variable of the RECT structure for richedit window was 20 pixels less than the right viariable of the parent modeless dialog box. I think those 20 pixels would be enough for me to insert a bullet bmp Yet when eyeballing the output, it seemed the text of the richedit was right up against the frame of the modeless dialog box I think 20 pixels would be something I would notice am I not understanding things correctly thanks

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      I'm not sure, but couldn't it be that the dialog's client rect is relative to the upper left of the window, while the child control's client rect is relative to the upper left of the dialog's client rect?

      The difficult we do right away... ...the impossible takes slightly longer.

      F 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        I'm not sure, but couldn't it be that the dialog's client rect is relative to the upper left of the window, while the child control's client rect is relative to the upper left of the dialog's client rect?

        The difficult we do right away... ...the impossible takes slightly longer.

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Not sure what you mean by window in dialog box same as CFRamewnd there is a frame that takes up space The GetClientRect implies as in Client the white back ground portion I mean if you were to Draw text the coordinates would be the white back ground right So if the richedit child control is +20 from the client area of dialog the text I’m writting to or streaming shouldn’t be right up against the frame right ?

        1 Reply Last reply
        0
        • F ForNow

          Hi I have a richedit control as child control in my modeless dialog. I have populated editcontrol via streamin SF_TEXT with a program listing. I am looking to insert a bullet to specify a breakpoint. After doing some research there were a number of articles about the richedit ole interface. With the bitmap being an ole client. I remember at one time getting this work (had different computer but still had windows 10) regardless just looking back at those articles it seems the ole support would only work with RTF format text. I am now thinking of going back to original API for bitmaps by that I mean BitBlt and or Strechbilt. In my initdialog after creating the rich edit both object via new and creating a HWND via DDX_CONTROL I did a Clientrect on bot the modless dialog box and the richedit control it showed that right variable of the RECT structure for richedit window was 20 pixels less than the right viariable of the parent modeless dialog box. I think those 20 pixels would be enough for me to insert a bullet bmp Yet when eyeballing the output, it seemed the text of the richedit was right up against the frame of the modeless dialog box I think 20 pixels would be something I would notice am I not understanding things correctly thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I don't have MFC so I cannot test this control. However, it occurs to me that perhaps the RichEdit control reserves some edge space for its own purposes (possibly a scrollbar). Try calling GetWindowRect on the control and compare that with the dialog's client rect. [edit] I just checked the difference between the Window and Client sizes of a simple Edit control. The width was 25 pixels different, and the height 4. So I guess what you are seeing is correct. [/edit]

          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