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. help me

help me

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
6 Posts 5 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
    Anonymous
    wrote on last edited by
    #1

    I want to get width and height of richedit control how to get it! thanks

    K P 2 Replies Last reply
    0
    • A Anonymous

      I want to get width and height of richedit control how to get it! thanks

      K Offline
      K Offline
      Ken Mazaika
      wrote on last edited by
      #2

      Is there a getclientrect() member function? Just a guess.... -Ken Mazaika

      P 1 Reply Last reply
      0
      • K Ken Mazaika

        Is there a getclientrect() member function? Just a guess.... -Ken Mazaika

        P Offline
        P Offline
        perlmunger
        wrote on last edited by
        #3

        GetClientRect returns just the client area. GetWindowRect returns the area of the entire CWnd object. See API docs for CWnd. Best Regards. -Matt ------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall

        1 Reply Last reply
        0
        • A Anonymous

          I want to get width and height of richedit control how to get it! thanks

          P Offline
          P Offline
          Peter Occil
          wrote on last edited by
          #4

          #define RectWidth(lprc) ((lprc)->right-(lprc)->left)
          #define RectHeight(lprc) ((lprc)->bottom-(lprc)->top)

          RECT rc;
          int width,height;
          GetWindowRect(hwndRichEdit,&rc);
          width=RectWidth(&rc);
          height=RectHeight(&rc);

          Peter O.

          P 1 Reply Last reply
          0
          • P Peter Occil

            #define RectWidth(lprc) ((lprc)->right-(lprc)->left)
            #define RectHeight(lprc) ((lprc)->bottom-(lprc)->top)

            RECT rc;
            int width,height;
            GetWindowRect(hwndRichEdit,&rc);
            width=RectWidth(&rc);
            height=RectHeight(&rc);

            Peter O.

            P Offline
            P Offline
            perlmunger
            wrote on last edited by
            #5

            I'm curious as to why you would do it that way. This is not a criticism, just a curiosity. Why couldn't you just use CRect instead? Also, why are you using the globally scoped GetWindowRect rather than the CWnd GetWindowRect? Is there a benefit to doing it that way? Here's the way I would do it:

            int width = 0, height = 0;
            CRect rect;
            GetWindowRect( rect ); // Single parameter CWnd::GetWindowRect
            width = rect.Width();
            height = rect.Height();

            Thanks. -Matt ------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall

            T 1 Reply Last reply
            0
            • P perlmunger

              I'm curious as to why you would do it that way. This is not a criticism, just a curiosity. Why couldn't you just use CRect instead? Also, why are you using the globally scoped GetWindowRect rather than the CWnd GetWindowRect? Is there a benefit to doing it that way? Here's the way I would do it:

              int width = 0, height = 0;
              CRect rect;
              GetWindowRect( rect ); // Single parameter CWnd::GetWindowRect
              width = rect.Width();
              height = rect.Height();

              Thanks. -Matt ------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall

              T Offline
              T Offline
              Tim Smith
              wrote on last edited by
              #6

              Maybe he isn't using MFC/WTL or doesn't want to force that dependency on others. Tim Smith "Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution." Hoare - 1980 ACM Turing Award Lecture

              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