BUG: EditCopy Incorrectly Copies Series Edge/Line Color of Chart
ID: Q188006
|
The information in this article applies to:
-
Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0
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:
Q161299 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. We are researching this
bug and will post new information here in the Microsoft Knowledge
Base as it becomes available.
MORE INFORMATIONSteps 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
- Press the F5 key to run the project. Click Form1.
- 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.
Workaround
- Start a new project. Form1 is created by default.
- Add a PictureBox control to Form1.
- Add an MSChart control so that it is inside the PictureBox control.
- 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. Notice that this also changes the Edge/Line Color
to Purple as well. Click OK.
- 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
- Add a Module to the project.
- Add the code in step 6 in the MORE INFORMATION section of the following
article to the Module:
Q161299 HOWTO: Capture and Print the Screen, a Form, or any Window
- Run the project and click the Form to copy the chart to the clipboard.
Additional query words:
kbDSupport kbDSD kbVBp kbCtrl kbVBp500bug kbPrint kbVBp600bug
Keywords : kbGrpVB
Version :
Platform : WINDOWS
Issue type : kbbug
|