Solved

Print a MsChart control with VC++ 6.0

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fully specialized class template function 21 136
best sources to up-to-date in C++? 8 82
Android development question 2 38
How do i run a c++ file? 15 31
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

831 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