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. views in dialog

views in dialog

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsc++helptutorialquestion
1 Posts 1 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
    asdeshmukh
    wrote on last edited by
    #1

    Hi, I have created a CWnd in a CPropertyPage. I want to display some drawing inside the CWnd. How can this be achieved? I tried the following approaches but did not succeed: 1) Tried creating CWnd object in the CPropertyPage class and then override the OnInit function to draw . I used the GetDC() to get the CDC and then the GetSafeHandle() function to get the HDC. I used this handle to render my drawing. The CWnd was created but the drawing is not displayed. 2) According to a suggestion from a colleague, I tried creating separate class for the CWnd object. This was to let me override the OnPaint function of the CWnd object. My code in OnPaint function is as follows: PAINTSTRUCT ps; CDC * dc = this->BeginPaint(&ps); //draw function takes in the CDC * dc obtained in fuction above draw(); this->EndPaint( &ps ); Then I created a object of this class in CPropertyPage class. I tried calling the create function in the constructor and OnCreate function of the property page. Here again I could at the most get my window displayed but no drawing. Any suggestions on how to achieve this? Also, does MFC basically support GDI in CWnd objects when created as child window of a dialog or property page? P.S. to make sure that the code to draw is working correctly, I tried testin that by having the rendering in a document using the view class. It works correctly i.e. I can get the display in a document window but cannot get it in dialog window or to be precise CWnd instance. Thanks in advance for your help. Regards, Abhijit Deshmukh

    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