Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Saving a MSChart image to file

Total Hit ( 5898)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


To save to file the graph generated by a MSChart control, you must use the control’s EditCopy method to copy the image into the clipboard, and then paste it into a PictureBox control. Then, just use the SavePicture function to save the PictureBox’s content to file. Here’s an example:

Click here to copy the following block
Private Sub Command1_Click()
  MSChart1.EditCopy
  Picture1.Picture = Clipboard.GetData(vbCFMetaFile)
  SavePicture Picture1.Picture, "C:\Image1.wmf"
End Sub

And here’s a reusable routine:

Click here to copy the following block
Sub SaveMSChart(graph as MSChart, pic as PictureBox, ByVal fileName As String)
  ' copy the graph into the clipboard
  graph.EditCopy
  ' paste the clipboard’s content into the PictureBox
  pic.Picture = Clipboard.GetData(vbCFMetaFile)
  ' save to file
  SavePicture pic.Picture, fileName
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.