Microsoft KB Archive/188006

= BUG: EditCopy Incorrectly Copies Series Edge/Line Color of Chart =

Article ID: 188006

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q188006



SYMPTOMS
When you use the Editcopy method of the MSChart control to copy a chart to the clipboard, the Edge/Line color and style of the series is not correct.



RESOLUTION
To work around this problem, contain the MSChart control within a PictureBox and then use Win32 API functions to capture the PictureBox image. For more information about capturing an image using the Win32 API functions, see the following article in the Microsoft Knowledge Base:

161299 HOWTO: Capture and Print the Screen, a Form, or any Window

(You will be adding code from the above article if you use the procedures below.)

The workaround is described in more detail in the MORE INFORMATION section of this article.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Start a new project. Form1 is created by default. Click Components on the Project menu and check "Microsoft Chart Control." Add an MSChart control to Form1. Right-click the MSChart control and choose Properties from the drop-down menu. Select the Series Color tab. Change the Interior color of Series "C1" from Red to Purple. Note that this also changes the Edge/Line Color to Purple as well. Click OK.  Add the following code to the Click event of Form1: MSChart1.EditCopy </li> Press the F5 key to run the project. Click Form1.</li> Run another application, such as Paint or Word, and paste the clipboard contents. (Use Paste Special if you see the chart's data instead of the actual chart.) Note that in the picture of the chart, Series "C1" has a purple interior but the edge/line color is red.</li></ol>

Workaround
<ol> Start a new project. Form1 is created by default.</li> Add a PictureBox control to Form1.</li> Add an MSChart control so that it is inside the PictureBox control.</li> Right-click the MSChart control and choose Properties from the drop-down menu.</li> Select the Series Color tab. Change the Interior color of Series "C1" from Red to Purple. Notice that this also changes the Edge/Line Color to Purple as well. Click OK.</li>  Add the following code to the Click event of Form1: Dim pic As Picture

With Picture1 'Size/position the picture box so that it matches 'the MSChart control .Width = MSChart1.Width .Height = MSChart1.Height MSChart1.Top = 0 MSChart1.Left = 0 'Get a picture of the contents of the picturebox Set pic = CaptureWindow(.hWnd, False, 0, 0, _           .ScaleX(.Width, vbTwips, vbPixels), _            .ScaleY(.Height, vbTwips, vbPixels)) End With

'Copy the picture to the clipboard Clipboard.Clear Clipboard.SetData pic </li> Add a Module to the project.</li> Add the code in step 6 in the MORE INFORMATION section of the following article to the Module:

161299 HOWTO: Capture and Print the Screen, a Form, or any Window

</li> Run the project and click the Form to copy the chart to the clipboard.</li></ol>

Additional query words: kbDSupport kbDSD kbVBp kbCtrl kbVBp500bug kbPrint kbVBp600bug

Keywords: kbbug KB188006

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.