2012-04-16 59 views
1

我想在我的WPF項目中使用TeeChart(http://www.teechart.net/)ScrollPager工具,但它不起作用。 (TeeChart.WPF.dll版本4.1.2012.2287)
TeeChart ScrollPager工具在WPF項目中不起作用

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



謝謝,
亞歷

回答

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

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> 

我也得到相同的結果的WinForms。如果使用我的代碼,請再試一次您的問題已解決或仍然出現。如果您的問題沒有解決,請您發送一個簡單的示例項目,我們可以「按原樣」運行,以便在steema.net/upload處重現此問題?

感謝,

問候

桑德拉

+0

桑德拉,你的代碼工作就像一個魅力!你拯救了我的一天。 不幸的是,我們仍然無法使用它,因爲滾動超出範圍(應用程序掛起)時還有一個錯誤)) 一切順利, Alex – ingeniero 2012-04-18 14:58:32