【Stimulsoft Reports Flex教程】更改报表查看器主题
此示例显示如何选择报表查看器主题。要从代码创建和显示查看器,您需要调用StiViewerFx.initialize()静态方法。在应用程序的initialize事件中调用此方法:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768" backgroundColor="#e8e8e8" initialize="onInitialize()" xmlns:viewer="stimulsoft.viewer.*">
private function onInitialize(): void { StiViewerFx.initialize(); ... }
要更改报表查看器主题,您只需为StiThemeManager.theme静态属性指定新值,例如StiTheme.black值。完成此操作后,您可以显示查看器:
private function onSetBlackThemeClick(): void { // Set Black theme StiThemeManager.theme = StiTheme.black; } private function onShowViewerClick(): void { // Create new report object var report: StiReport = new StiReport(); // Load document from XML string report.loadDocumentFromString(documentString); // Show report in Viewer report.showDialog(); }
下面的屏幕截图中,您可以看到示例代码的结果。