Solved

Print a MsChart control with VC++ 6.0

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
maze travler 6 73
mixing C++ & C# in Vis Studio 2013 7 280
Problem with SqlConnection 4 193
draw a Christmas tree by using a nested loop? 26 105
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

739 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