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. Is it possible to draw on dialog

Is it possible to draw on dialog

Scheduled Pinned Locked Moved C / C++ / MFC
comsysadmin
19 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.
  • S shivditya

    I am very sorry yah I am passing only hadle and pointer to RECT. I found that handle from ID.But Problem is there,as I used this fnction so many times It works fine.

    || ART OF LIVING ||

    M Offline
    M Offline
    Mark Salsbery
    wrote on last edited by
    #10

    I can't imagine what the problem is. Maybe a bit of debugging on your end will help? Mark

    "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

    1 Reply Last reply
    0
    • L led mike

      Why draw on the dialog? Why not draw in your own window that is a child of the dialog? Of course while drawing on a dialog it's a good time to eat your Fish Filet Actually I am not sure he needs to draw, maybe just use a static control and put some text in it, hard to say from his post. I think he really needs[^]

      S Offline
      S Offline
      shivditya
      wrote on last edited by
      #11

      Was it a joke or anything. No doubt my total VC experience and total experience is 1.5 years , and Basically I am Mechanical Engineer, but right now I am developing FingurePrint Identification Server For ATM Parallel to Main Switch for Identification Aplab India, Near CheckNaka, Thane(W), Maharshtra India -400604. I am putting in joke to bypass from main discussion.

      || ART OF LIVING ||

      1 Reply Last reply
      0
      • L led mike

        Why draw on the dialog? Why not draw in your own window that is a child of the dialog? Of course while drawing on a dialog it's a good time to eat your Fish Filet Actually I am not sure he needs to draw, maybe just use a static control and put some text in it, hard to say from his post. I think he really needs[^]

        S Offline
        S Offline
        shivditya
        wrote on last edited by
        #12

        I am not that master of VC ,but I have to work on very higher end. I need to show somehow how many atms ,which all atms are currently running. Doubt is lack of Life force , Answers cannot satify doubt Only Art Of Living Can Solve www.artofliving.org

        1 Reply Last reply
        0
        • S shivditya

          I am building application as secondary identification server for ATMs. My application is fine. But just for pictorial representation I want to show ATM line on dialog who alls thread is currently active. I am planning to show on dialog it self. (Or I have to develop separate ActiveX for doing so,please suggest) while showing on dialog , I am not getting crash of GetWindowRect and device context of dialog window may not proper.It crashes at ::GetWindowRect Of groupbox in which I was planning to show the running threads. I am not sure why crash is occuring. I am not sure devicecontext I can obtain.

          || ART OF LIVING ||

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #13

          shivditya wrote:

          It crashes at ::GetWindowRect Of groupbox in which I was planning to show the running threads.

          "show the running threads" what does that mean? Show them how? If you just want to display some text put a static control in side the GroupBox control and then SetWindowText on the static control.

          S 1 Reply Last reply
          0
          • L led mike

            shivditya wrote:

            It crashes at ::GetWindowRect Of groupbox in which I was planning to show the running threads.

            "show the running threads" what does that mean? Show them how? If you just want to display some text put a static control in side the GroupBox control and then SetWindowText on the static control.

            S Offline
            S Offline
            shivditya
            wrote on last edited by
            #14

            No not like that. Just like bar graph I said Group Box Because ,I Just kept groupbox to have some border around Graph. And I was taking its rect because I was willing to have some Base coordinates.Which ATM is running ,graph line will be shown for it on y axis. And ATMs will be on X axis.

            || ART OF LIVING ||

            L 1 Reply Last reply
            0
            • S shivditya

              No not like that. Just like bar graph I said Group Box Because ,I Just kept groupbox to have some border around Graph. And I was taking its rect because I was willing to have some Base coordinates.Which ATM is running ,graph line will be shown for it on y axis. And ATMs will be on X axis.

              || ART OF LIVING ||

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #15

              shivditya wrote:

              Just like bar graph

              Ok then you definitely don't want to draw that on a dialog that has other controls on it. You want to make your own window and draw the graph in there then that window is placed on the dialog as a child like other controls are. If you are using MFC you just derive from CWnd then in the dialog you setup the window as a child using whats called "subclass"ing. Have you looked at the C++ articles here on CodeProject. I would imagine there are some that walk you through all of this. There is probably even a article with code that will draw the bar graph for you.

              S 1 Reply Last reply
              0
              • L led mike

                shivditya wrote:

                Just like bar graph

                Ok then you definitely don't want to draw that on a dialog that has other controls on it. You want to make your own window and draw the graph in there then that window is placed on the dialog as a child like other controls are. If you are using MFC you just derive from CWnd then in the dialog you setup the window as a child using whats called "subclass"ing. Have you looked at the C++ articles here on CodeProject. I would imagine there are some that walk you through all of this. There is probably even a article with code that will draw the bar graph for you.

                S Offline
                S Offline
                shivditya
                wrote on last edited by
                #16

                Thanks I will Search for it. Conclusion 1) Drawing on dialog is not so easy. 2) Subclassing will help // I dont 3) Can diretly add classes which are already developed. Will you please redirect me to what exactly you mean by placing child window on dialog. class CDerived : public CMyMainDialog { -------- }; CMyMainDialog cm = new CDerived() cm.Domodal();

                || ART OF LIVING ||

                L M 2 Replies Last reply
                0
                • S shivditya

                  Thanks I will Search for it. Conclusion 1) Drawing on dialog is not so easy. 2) Subclassing will help // I dont 3) Can diretly add classes which are already developed. Will you please redirect me to what exactly you mean by placing child window on dialog. class CDerived : public CMyMainDialog { -------- }; CMyMainDialog cm = new CDerived() cm.Domodal();

                  || ART OF LIVING ||

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #17

                  shivditya wrote:

                  Will you please redirect me to what exactly you mean by placing child window on dialog.

                  It's called subclassing and you should find tons of articles here on CodeProject in the C++ and/or MFC categories that will help in this subject.

                  1 Reply Last reply
                  0
                  • S shivditya

                    Thanks I will Search for it. Conclusion 1) Drawing on dialog is not so easy. 2) Subclassing will help // I dont 3) Can diretly add classes which are already developed. Will you please redirect me to what exactly you mean by placing child window on dialog. class CDerived : public CMyMainDialog { -------- }; CMyMainDialog cm = new CDerived() cm.Domodal();

                    || ART OF LIVING ||

                    M Offline
                    M Offline
                    Mark Salsbery
                    wrote on last edited by
                    #18

                    shivditya wrote:

                    Conclusion 1) Drawing on dialog is not so easy. 2) Subclassing will help // I dont 3) Can diretly add classes which are already developed.

                    1. Drawing on a dialog is just as easy as drawing on any window. It's just not a good solution beyond maybe drawing a custom background. 2) You're using MFC - the subclassing is done for you if you use CWnd as a base class.

                    shivditya wrote:

                    what exactly you mean by placing child window on dialog.

                    Every control on your dialog is already a child window of the dialog. It seems logical, then, if you need an area of the dialog to draw in then you should use a child window to do so. You can place your child window on the dialog just like you'd use a child window anywhere - 1) Implement the window class, or use an existing window class, perhaps 3rd-party code 2) Create a child window object of that class 3) Create the Windows object (HWND) for the window object, using the dialog window as the parent

                    "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                    S 1 Reply Last reply
                    0
                    • M Mark Salsbery

                      shivditya wrote:

                      Conclusion 1) Drawing on dialog is not so easy. 2) Subclassing will help // I dont 3) Can diretly add classes which are already developed.

                      1. Drawing on a dialog is just as easy as drawing on any window. It's just not a good solution beyond maybe drawing a custom background. 2) You're using MFC - the subclassing is done for you if you use CWnd as a base class.

                      shivditya wrote:

                      what exactly you mean by placing child window on dialog.

                      Every control on your dialog is already a child window of the dialog. It seems logical, then, if you need an area of the dialog to draw in then you should use a child window to do so. You can place your child window on the dialog just like you'd use a child window anywhere - 1) Implement the window class, or use an existing window class, perhaps 3rd-party code 2) Create a child window object of that class 3) Create the Windows object (HWND) for the window object, using the dialog window as the parent

                      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                      S Offline
                      S Offline
                      shivditya
                      wrote on last edited by
                      #19

                      I got now by looking in article the subclassing means customising. And I have done it many times,without knowing that term. Ok I will try out ,based on time in hand.

                      || ART OF LIVING ||

                      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