我想在我的WPF项目中使用TeeChart (http://www.teechart.net/)ScrollPager工具,但它不起作用。(TeeChart.WPF.dll版本 4.1.2012.2287)
http://img190.imageshack.us/img190/4900/scrwpf.png
namespace TeeChart
{
using Steema.TeeChart.WPF.Themes;
using Steema.TeeChart.WPF.Tools;
using Steema.TeeChart.WPF.Styles;
using Steema.TeeChart.WPF.Drawing;
public partial class MainWindow
{
private Line _series;
private ScrollPager _tool;
BlackIsBackTheme _black;
public MainWindow()
{
InitializeComponent();
_series = new Line();
tChart1.Series.Add(_series);
tChart1.Chart.Aspect.View3D = false;
tChart1.Header.Visible = false;
tChart1.Legend.Visible = false;
_series.FillSampleValues(500);
_black = new BlackIsBackTheme(tChart1.Chart);
_black.Apply();
_tool = new ScrollPager();
tChart1.Tools.Add(_tool);
_tool.Series = _series;
_black = new BlackIsBackTheme(_tool.SubChartTChart.Chart);
_black.Apply();
_tool.SubChartTChart.Panel.Pen.Visible = false;
_tool.SubChartTChart.Panel.Bevel.Inner = BevelStyles.None;
_tool.SubChartTChart.Panel.Bevel.Outer = BevelStyles.None;
}
}
}
在WinForms项目中,它工作正常。
http://img692.imageshack.us/img692/4527/scrwinforms.png
namespace TeeChartWinForms
{
using System.Windows.Forms;
using Steema.TeeChart.Drawing;
using Steema.TeeChart.Styles;
using Steema.TeeChart.Themes;
using Steema.TeeChart.Tools;
public partial class Form1 : Form
{
private Line _series;
private ScrollPager _tool;
BlackIsBackTheme _black;
public Form1()
{
InitializeComponent();
_series = new Line();
tChart1.Series.Add(_series);
tChart1.Chart.Aspect.View3D = false;
tChart1.Header.Visible = false;
tChart1.Legend.Visible = false;
_series.FillSampleValues(500);
_black = new BlackIsBackTheme(tChart1.Chart);
_black.Apply();
_tool = new ScrollPager();
tChart1.Tools.Add(_tool);
_tool.Series = _series;
_black = new BlackIsBackTheme(_tool.SubChartTChart.Chart);
_black.Apply();
_tool.SubChartTChart.Panel.Pen.Visible = false;
_tool.SubChartTChart.Panel.Bevel.Inner = BevelStyles.None;
_tool.SubChartTChart.Panel.Bevel.Outer = BevelStyles.None;
}
}
}
谢谢
亚历克斯
似乎使用下一个代码时您的问题不会出现:
代码 c#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Steema.TeeChart.WPF;
using Steema.TeeChart.WPF.Styles;
using System.IO;
using System.Windows.Markup;
using Steema.TeeChart.WPF.Tools;
using Steema.TeeChart.WPF.Drawing;
using Steema.TeeChart.WPF.Themes;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
private Steema.TeeChart.WPF.Styles.Line series;
private ScrollPager tool;
BlackIsBackTheme black;
public MainWindow()
{
InitializeComponent();
series = new Steema.TeeChart.WPF.Styles.Line();
tChart1.Series.Add(series);
tChart1.Chart.Aspect.View3D = false;
tChart1.Header.Visible = false;
tChart1.Legend.Visible = false;
series.FillSampleValues(500);
black = new BlackIsBackTheme(tChart1.Chart);
black.Apply();
tool = new ScrollPager(tChart1.Chart);
tool.Series = series;
black = new BlackIsBackTheme(tool.SubChartTChart.Chart);
black.Apply();
tool.SubChartTChart.Panel.Pen.Visible = false;
tool.SubChartTChart.Panel.Bevel.Inner = BevelStyles.None;
tool.SubChartTChart.Panel.Bevel.Outer = BevelStyles.None;
}
}
}
代码 XAML:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tc="clr-namespace:Steema.TeeChart.WPF;assembly=TeeChart.WPF"
Title="MainWindow" SizeToContent="WidthAndHeight" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="516" d:DesignWidth="492">
<Grid >
<AdornerDecorator Margin="25,12,27,65">
<tc:TChart Name="tChart1" Height="226" Width="412" />
</AdornerDecorator>
</Grid>
</Window>
我得到的结果和赢形一样。如果使用我的代码,您的问题已解决或仍然出现,请重试。如果您的问题没有解决,您能否发送一个简单的示例项目,我们可以"按原样"运行以在 steema.net/upload 重现问题?
谢谢
此致敬意
桑德拉