Solved

save graphics

Posted on 2000-05-16
9
281 Views
Last Modified: 2010-05-02
URGENT!!!!!!!!!!

i've make graphics with mschart,and i want to know how i can save picture of graphics without using EditCopy.
i don't want to print graphics, i want to save them in a file.

can you help me
0
Comment
Question by:BUSY
9 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 2814757
M$Chart is a *turd*. You'll also have fun trying to *print*.

You can generate your own plotting routines fairly easily that will avoid all of the limits of the M$Chart control.

M
0
 
LVL 2

Expert Comment

by:Simonac
ID: 2814846
mark, I'm curious; i saw u comment many times as to how XXX it is to print a mschart; whats wrong with the folowing method?

    CommonDialog1.CancelError = True
    On Error GoTo NO_PRINT
    CommonDialog1.ShowPrinter   ' Allows printer selection (For color)
    On Error GoTo 0
   
    Printer.Orientation = vbPRORLandscape
    Printer.ScaleHeight = 8.5
    Printer.ScaleWidth = 11
    frmSTATS.FillCriteriasList lstDummy
   
    MSChart1.EditCopy
   
    For intNbCopies = 1 To CommonDialog1.Copies
        'Printer.PaintPicture Clipboard.GetData(), 0, lstDummy.ListCount * 0.3
        Printer.PaintPicture Clipboard.GetData(), 0.5, lstDummy.ListCount * 0.1, 10, 7.5
        For intCounter = 0 To lstDummy.ListCount - 1
            lstDummy.ListIndex = intCounter
            Printer.Print lstDummy.Text
        Next
        Printer.EndDoc
    Next
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2815052
Well the main problem is that your chart resolution is limited by the screen resolution. You're essentially dumping the screen display to the clipboard and printing the clipboard. This will give you a printout with no more resolution than your screen was at when the snap was taken. Even if you're running 1280x800 that only translates to a 4.25 x 2.7" print at 300DPI. It' gets worse as your printer resolution increases. Even if you Expand the PaintPicture to 11x8.5 this just makes the individual pixels *bigger* and your text will rapidly start to look blocky and unreadable. The lower the system screen rez when you start and the higher the printer rez the worse it gets. If you're starting with 640x400 and printing at 600DPI it looks like *hell*. Certainly not something I'd want to put my name on.

If you render directly to the printer device your text remains crisp and clear and as razor sharp as any DTP app will render. Your diagonal lines will have minimal "jaggies" and everything will be razor crisp. Additionally your output will no longer be dependent on the permutations of screen and printer resolution.

You also gain complete control over placement of text, graphics, backgrounds, etc. as well as being able to create mixed mode graphs that M$Chart couldn't do if it wanted to.

For instance I created a "string of pearls" polar plot that showed the relative distribution of "on a scale of 1-10" type answers ordered by 10 different axes. The plot looked like a radar display with all 10 axes radiating out like spokes and the 1-10 rings concentric. At the intersection of each spoke and ring was a colored circle who's radius indicated the relative %age of the responses on that axis that had the given value. Mean and +- sigma lines were also plotted. The "pearls" had different colors depending on there location relative to the +- sigmas. This reduced a *HUGE* amount of data into a pattern that could be understood at a glance. Lemme see you do *THAT* in M$Chart.

Other than that, there's no problem...

M
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:BUSY
ID: 2816103
Edited text of question.
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 2817288
Copy image of graph to clipboard.

Load image into picture box control

Use SavePicture to save to disk as .BMP file

M
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 2817660
yeah, and convert it to JPG to reduce disk space.....:)
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2818357
But SavePicture only saves as .BMP. You'll need an additional 3rd party control to convert .BMP to .JPG...

M
0
 

Author Comment

by:BUSY
ID: 2820547
it's very easy when we have the information
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2821000
Thanx for the points - glad to help.

M
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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