How do you print a Chart from a VB6 form?

J

Jim.Hubbard

It doesn't seem that there is a print function.



Since I am using the chart control from a VB6 form, I am working on
saving the image to disk then loading that into a picturebox and
printing from there.



If anyone knows an easier or more proper way to do this from a VB6
form, I'd love to hear about it.
 
J

Jim.Hubbard

Don't bother with anything like this either....



'-----------------------------------------------------------------------
--

Dim sTmpFile As String

Dim sMsg As String

Dim hFile As Long



sTmpFile = CreateTempFile("jTmp", "gif")

'Gets the next available open number

hFile = FreeFile



Open sTmpFile For Binary As hFile

Put #hFile, , CSpace.GetPicture("gif", 600, 400)

Close hFile



Call ShellExecute(0&, "Print", sTmpFile, vbNullString,
vbNullString, vbHide)



'-----------------------------------------------------------------------
--



Forget the shellExecute statement not working....the "gif" file
produced is not recognized by any image viewer that I have.
 
J

Jim.Hubbard

I got it...



ChartSpaceName.ExportPicture FileNameToSaveAs, "gif", Width, Height



Load it into a picturebox control and print it out.



But the quality of these images is very poor. Anyone seen how to
improve the quality of the printed images?



Yes, I've tried PrintQuality3D.....it had no effect on the
print quality.
 
T

Thao Moua [ms]

Make sure the exportpicture size and the picturebox
control size are identical. Mismatching them will cause
the picture to be altered.

If you're using OWC10, try exporting the picture to PNG
and JPG. They might give better results.

Thao Moua
OWC Webchart Support
 
J

Jim Hubbard

Does the JPG have a % for the quality of the JPG image?

And, this may be a little off topic, but why is it that, in VB6, some of the
properties and methods do not show in intellisense?

Typing something like "ChartSpace1." shows lots of intellisense information,
including "InternalPivotTable", but when you select InternalPivotTable and
type a period (giving you "ChartSpace1.InternalPivotTable.") no more
intellisense information of available properties like "ActiveView" is shown.

Why is the intellisense shorted out like this? Am I doing something wrong?

Jim
 
T

Thao Moua [ms]

I thought I responded to the intellisense issue but I
guess not.

The reason why you're not getting intellisense is because
some property/object type returns a type OBJECT or a
generic class. This is useful for future flexibility.
If you want to know what the object type really is, do a
Typename(X) and then declare a variable of that specific
type. Then set your variable to the object you want to
access (ie. oPT=CS.InternalPivotTable) Now your variable
will have intellisense.

Thao Moua
OWC Webchart Support
-----Original Message-----

Does the JPG have a % for the quality of the JPG image?

And, this may be a little off topic, but why is it that, in VB6, some of the
properties and methods do not show in intellisense?

Typing something like "ChartSpace1." shows lots of intellisense information,
including "InternalPivotTable", but when you select InternalPivotTable and
type a period (giving
you "ChartSpace1.InternalPivotTable.") no more
 
J

Jim Hubbard

Thanks!

Any info on programmatically selecting/deselecting the series data (listed
in "Field List" and shows in the legend)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top