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. create rectangle box ,display inside system time how?

create rectangle box ,display inside system time how?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
7 Posts 4 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.
  • N Offline
    N Offline
    nisha00000
    wrote on last edited by
    #1

    Hi friends i want to create one rectangle box in that rectangle box inside displays the system date how to do that in MFC? please give me your code snippet Thanks and regards Nisha.S

    S 1 Reply Last reply
    0
    • N nisha00000

      Hi friends i want to create one rectangle box in that rectangle box inside displays the system date how to do that in MFC? please give me your code snippet Thanks and regards Nisha.S

      S Offline
      S Offline
      shaina2231
      wrote on last edited by
      #2

      to create rectangle firstly draw group box id (IDC_STATIC) then hide it and using following code on paint method u can draw rectangle ... CPaintDC dc(this); // device context for painting CRect rc; CWnd * pW = this->GetDlgItem(IDC_STATIC); pW->GetClientRect(&rc); pW->ClientToScreen(&rc); this->ScreenToClient(&rc); //dc.FillSolidRect(&rc,RGB(50,50,50)); dc.Draw3dRect(rc.left+2, rc.top+5, rc.Width()+1, rc.Height()-3, RGB(255, 255, 0), RGB(255, 255, 0)); dc.Draw3dRect(rc.left+1, rc.top+4, rc.Width(), rc.Height()-4, RGB(255, 255, 0), RGB(255, 255, 0));

      N 1 Reply Last reply
      0
      • S shaina2231

        to create rectangle firstly draw group box id (IDC_STATIC) then hide it and using following code on paint method u can draw rectangle ... CPaintDC dc(this); // device context for painting CRect rc; CWnd * pW = this->GetDlgItem(IDC_STATIC); pW->GetClientRect(&rc); pW->ClientToScreen(&rc); this->ScreenToClient(&rc); //dc.FillSolidRect(&rc,RGB(50,50,50)); dc.Draw3dRect(rc.left+2, rc.top+5, rc.Width()+1, rc.Height()-3, RGB(255, 255, 0), RGB(255, 255, 0)); dc.Draw3dRect(rc.left+1, rc.top+4, rc.Width(), rc.Height()-4, RGB(255, 255, 0), RGB(255, 255, 0));

        N Offline
        N Offline
        nisha00000
        wrote on last edited by
        #3

        hi thanks to replay its create rectangle successfully .and how to display system time inside this rectangle box

        _ 1 Reply Last reply
        0
        • N nisha00000

          hi thanks to replay its create rectangle successfully .and how to display system time inside this rectangle box

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          you have a pointer for the window. Use GetSystemTime/GetLocalTime to get the time and then CString::Format function to get it in the desired format, after this you can use SetWindowText

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          N 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            you have a pointer for the window. Use GetSystemTime/GetLocalTime to get the time and then CString::Format function to get it in the desired format, after this you can use SetWindowText

            Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

            N Offline
            N Offline
            nisha00000
            wrote on last edited by
            #5

            can u plz write the code snippet for that problem

            _ O 2 Replies Last reply
            0
            • N nisha00000

              can u plz write the code snippet for that problem

              _ Offline
              _ Offline
              _AnsHUMAN_
              wrote on last edited by
              #6

              I am new to the coding world and in need of money desperately... :-O

              Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

              1 Reply Last reply
              0
              • N nisha00000

                can u plz write the code snippet for that problem

                O Offline
                O Offline
                onlyjaypatel
                wrote on last edited by
                #7

                SYSTEMTIME st; GetLocalTime(&st); now in st all values of date time Use CString Format function to convert in stinrg

                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