Megosztás a következőn keresztül:


Chart Control

The Chart control is a chart object that exposes events. When you add a chart to a worksheet, Visual Studio creates a Chart object that you can program against directly without having to traverse the Microsoft Office Excel object model.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2013 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

Creating the Control

You can add Chart controls to a Microsoft Office Excel worksheet at design time or at run time in a document-level project.

You can add Chart controls to a worksheet at run time in an application-level add-in. For more information, see How to: Add Chart Controls to Worksheets.

Note

Dynamically created chart objects are not persisted in the worksheet as host controls when the worksheet is closed. For more information, see Adding Controls to Office Documents at Run Time.

Formatting

All formatting that can be applied to a Chart can also be applied to a Chart control. This includes borders, fonts, chart type, gridlines, legend, and data labels.

Events

The following events are available for the Chart control:

See Also

Tasks

How to: Add Chart Controls to Worksheets

Concepts

Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time

Adding Controls to Office Documents at Run Time

Automating Excel by Using Extended Objects

Programmatic Limitations of Host Items and Host Controls

Other Resources

Office Development Samples and Walkthroughs

Controls on Office Documents

Binding Data to Controls in Office Solutions