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
Solved

Print a MsChart control with VC++ 6.0

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 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 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…

808 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