none
MFC drawing shapes

    Question

  • Hi,

    I would like to draw simple shapes such as a rectangle and circle on an MFC application, but I'm not too familiar with how to initialize a CDC object and then calling functions such as drawRect etc.

    Is there a simple demo I could look at, or if anyone can show me a couple of lines to start me off that would really help me out.  Thanks so much.

    - Joe
    Saturday, June 28, 2008 7:23 PM

Answers

  • There is the scribble MFC application sample. We used to have a step-by-step tutorial which explained basic concepts of typical MFC applications. The sample is still available, but I have no idea what happened to the documentation. I hope I'll find out soon.

    Anyway, you may want to take a look at the View::OnDraw implementation of the Scribble MFC sample.

    That being said, MFC functions are mostly relatively thin wrappers around the Windows functionality. The functionality provided by the CDC derived classes comes from Windows GetDC, GetWindowDC, BeginPaint et al.

    The Windows documentation is generally much more comprehensive than MFC on the internals.

    -hg
    Visual C++ Libraries Team
    • Marked as answer by Yan-Fei Wei Tuesday, July 01, 2008 6:17 AM
    Sunday, June 29, 2008 1:00 PM
  • I like video tutorials , there is a good video on MSDN for Drawing
    http://msdn.microsoft.com/en-us/visualc/bb814927.aspx

    also you can take a look at the msdn  CDC class
    http://msdn.microsoft.com/de-de/library/fxhhde73(VS.80).aspx
    Vikas
    • Marked as answer by Yan-Fei Wei Tuesday, July 01, 2008 6:17 AM
    Monday, June 30, 2008 3:50 PM
  • Hi

    May be this form helpful check:

    http://forums.msdn.microsoft.com/en-US/vclanguage/thread/b8774070-04d7-4d77-b99a-609adea6ed8c

    Regards
    Akeeq
    • Marked as answer by Yan-Fei Wei Tuesday, July 01, 2008 6:18 AM
    Tuesday, July 01, 2008 4:38 AM

All replies

  • There is the scribble MFC application sample. We used to have a step-by-step tutorial which explained basic concepts of typical MFC applications. The sample is still available, but I have no idea what happened to the documentation. I hope I'll find out soon.

    Anyway, you may want to take a look at the View::OnDraw implementation of the Scribble MFC sample.

    That being said, MFC functions are mostly relatively thin wrappers around the Windows functionality. The functionality provided by the CDC derived classes comes from Windows GetDC, GetWindowDC, BeginPaint et al.

    The Windows documentation is generally much more comprehensive than MFC on the internals.

    -hg
    Visual C++ Libraries Team
    • Marked as answer by Yan-Fei Wei Tuesday, July 01, 2008 6:17 AM
    Sunday, June 29, 2008 1:00 PM
  • I like video tutorials , there is a good video on MSDN for Drawing
    http://msdn.microsoft.com/en-us/visualc/bb814927.aspx

    also you can take a look at the msdn  CDC class
    http://msdn.microsoft.com/de-de/library/fxhhde73(VS.80).aspx
    Vikas
    • Marked as answer by Yan-Fei Wei Tuesday, July 01, 2008 6:17 AM
    Monday, June 30, 2008 3:50 PM
  • Hi

    May be this form helpful check:

    http://forums.msdn.microsoft.com/en-US/vclanguage/thread/b8774070-04d7-4d77-b99a-609adea6ed8c

    Regards
    Akeeq
    • Marked as answer by Yan-Fei Wei Tuesday, July 01, 2008 6:18 AM
    Tuesday, July 01, 2008 4:38 AM