Solved

Print a MsChart control with VC++ 6.0

Posted on 2000-03-01
2
440 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
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

707 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

13 Experts available now in Live!

Get 1:1 Help Now