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