CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    8

    draw chart on a picture control in dialog form?

    I have a picture control in a dialog form and I use
    CWnd *pWnd = (CWnd*)GetDlgItem(IDC_GRAPH_FRAME);
    CDC *pDC = pWnd->GetDC ();

    to get pDC and use it draw some lines on the picture. However, it seems the picture control does not update it automatically. So, if I have another window to cover the dialog form, after I move the window, the picture on dialog form will NOT refresh itself. If the project has doc/view, I can use OnDraw(). It is a dialog based form, What I should I?


    thanks

  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: draw chart on a picture control in dialog form?

    Quote Originally Posted by FlyingBear
    . . .to get pDC and use it draw some lines on the picture.
    Draw where?

    Quote Originally Posted by FlyingBear
    However, it seems the picture control does not update it automatically.
    Yes it does.

    Quote Originally Posted by FlyingBear
    If the project has doc/view, I can use OnDraw(). It is a dialog based form, What I should I?
    OnDraw is virtual override that is called from WM_PAINT handler of the CView class.
    Many control classes as well as CFormView derived class shortcuts this override since controls provide own drawing (tree or list view for example).

    So called picture control is really a static control that has certain styles allowing to display icons, bitmaps or other type of images.

    You can use any window to draw in it. Static control is not the best choice (that is why is called static) however painting is not impossible.

    You should have your own class and handle WM_PAINT to painting.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured