Graphical output on tab pages

Posted on 2006-04-16
Last Modified: 2010-04-24
How do I create graphical output that will go on a tab page in a Form, instead of on the body of the form? I have a Form which has several tab pages. I am trying to create a program that will draw different graphs to the different tab pages. For example, I want a horizontal line to be displayed on the second tab page ("tabPage2"). How would I modify the following code to specify the second tab page instead of the base Form?

      Graphics* pg = CreateGraphics();
      Pen* pen1 = new Pen(Color::Black, 1.0);

When I tried this code as written, the line appeared to be under the tab pages.
Question by:restabro
    LVL 48

    Assisted Solution

    Open tabPage2 in the form designer, click Properties - Events. Find the Paint event and double-click it. Designer creates Paint handler for this page:

    void tabPage2_Paint( Object8 sender, System::Windows::Forms::PaintEventArgs e)
       Graphics* g = e->Graphics;

       // place drawing code here
    LVL 12

    Accepted Solution

    owner draw the tab control, refer to the following page

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now