1

我想在我的 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;
        }
    }
}



谢谢,
亚历克斯

4

1 回答 1

2

使用下一个代码似乎没有出现您的问题:

代码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;
            }
}
}

代码 xml:

<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>

我得到与winforms相同的结果。如果使用我的代码解决了您的问题或仍然出现,请重试。如果您的问题没有解决,您能否发送一个简单的示例项目,我们可以在steema.net/upload上“按原样”运行以重现问题?

谢谢,

此致

桑德拉

于 2012-04-18T08:23:18.817 回答