Solved

Print a MsChart control with VC++ 6.0

Posted on 2000-03-01
2
446 Views
Last Modified: 2012-06-27
How can i Print a MsChartcontrol or a Datagrid in VC++ 6.0.

Thanks
0
Comment
Question by:Degrave
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
Binder earned 50 total points
ID: 2572400
  I will try to put here a bit of code. There are some things
that I don´t remember well, but you should be able to find it on MSDN.

     m_Chart is your control variable.

     m_Chart.EditCopy();
     OpenClipboard();

     //Retrieve a DIB from the Clipboard with GetClipBoardData(CF_DIB);
     //Retrieve info from DIB: width, height, etc.

    //Now the printing stuff
      CPrintDialog printDlg(FALSE);

       if (!AfxGetApp()->GetPrinterDeviceDefaults(&printDlg.m_pd))
          return;

     //Printer DC
       hdcPrint = printDlg.CreatePrinterDC();

       pDC = new CDC;
       pDC->Attach (hdcPrint);

       if (pDC->StartDoc("PRINTSERVICE") != -1)
       {
      pDC->StartPage();

                //Print with StretchDIBBlt
                  ::SetStretchBltMode(pDC->m_hDC, COLORONCOLOR);
        ::StretchDIBits( /*your stuff here */ );

                      pDC->EndPage(); //just one page
        pDC->EndDoc();
       }

       CloseClipboard();
     I don´t remember how to retrieve a DIB from the clipboard but I do
now that I read an article about this on MSDN, something like "retrieving
 a DIB from Clipboard".

    HTH
0
 

Author Comment

by:Degrave
ID: 2620012
Adjusted points from 20 to 50
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

628 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