![]() |
Copying Chart to Clipboard |
Post Reply
|
| Author | |
ChristineK
Newbie
Joined: 30 January 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Topic: Copying Chart to ClipboardPosted: 30 January 2012 at 12:18pm |
|
I am using ChartPro version 15.2.1 I need to be able to copy the chart that is drawn in my application to the clipboard for users to paste as a picture into something like Word or PowerPoint. Is there an easy way to do this?
|
|
![]() |
|
ABuenger
Newbie
Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
Quote Reply
Posted: 30 January 2012 at 2:19pm |
|
Hello,
please open a ticket and I'll provide the necessary code. Andre |
|
|
Codejock support
|
|
![]() |
|
ChristineK
Newbie
Joined: 30 January 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 01 February 2012 at 10:07am |
|
I'm sorry...I am new to ChartPro and this message board. How do I open a ticket?
|
|
![]() |
|
evoX
Senior Member
Joined: 25 July 2007 Status: Offline Points: 207 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 February 2012 at 9:19am |
|
Why don't you post here the code? because I also need this.
|
|
|
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit Language: Visual C++ (VS 2019) |
|
![]() |
|
Arnoutdv
Groupie
Joined: 29 September 2010 Status: Offline Points: 38 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 February 2012 at 9:38am |
|
I accomplished this by using an invisible picture control on the form.
The Visible property is set to False The AutoRedraw property is set to True
|
|
|
VB6 SP6, SuitePro 16.3.0 / 18.2.0, Win10/64
|
|
![]() |
|
ChristineK
Newbie
Joined: 30 January 2012 Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 February 2012 at 9:45am |
|
I figured out how to do this on my own. Here's the function I wrote:
void MyClass::OnCopyToClipboardChart() { // Get the size of the chart
rectangle CRect rect; m_chartControl1.GetClientRect(rect); rect.NormalizeRect(); if(rect.IsRectEmpty() ||
rect.IsRectNull()) return; // get the chart's device
context CDC *pDc =
m_chartControl1.GetWindowDC(); CDC memDc; if(!memDc.CreateCompatibleDC(pDc)) return; // create a bitmap of the
chart's current state CBitmap bitmap; if(
!bitmap.CreateCompatibleBitmap(pDc,rect.Width(), rect.Height())) return; CBitmap* pOldBitmap =
memDc.SelectObject(&bitmap); memDc.BitBlt(0,0,rect.Width(),rect.Height(),pDc,rect.left
, rect.top ,SRCCOPY ); if(OpenClipboard()) { // empty
clipboard data EmptyClipboard(); // put the chart
bitmap on the clipboard SetClipboardData(CF_BITMAP,bitmap.GetSafeHandle()); CloseClipboard(); } memDc.SelectObject(pOldBitmap); |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |