SmartQuant.FinChart.Chart.OnPaint C# (CSharp) Method

OnPaint() protected method

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void
        protected override void OnPaint(PaintEventArgs e)
        {
            lock (this.lockObject)
            {
                try
                {
                    Update(e.Graphics);
                    if (this.firstIndex < 0 || this.lastIndex <= 0)
                        return;
                    #if GTK
                    if (this.scrollbar.Adjustment.Upper != MainSeries.Count-1)
                    this.scrollbar.Adjustment.Upper = MainSeries.Count-1;
//                    if (this.scrollbar.Adjustment.Upper != this.mainSeries.Count - (this.lastIndex - this.firstIndex + 1) + this.scrollbar.Adjustment.PageIncrement - 1)
//                        this.scrollbar.Adjustment.Upper = this.mainSeries.Count - (this.lastIndex - this.firstIndex + 1) + this.scrollbar.Adjustment.PageIncrement - 1;
//                    Console.WriteLine("scrollvalue:{0} min:{1} max:{2}", this.scrollbar.Value,this.scrollbar.Adjustment.Lower,this.scrollbar.Adjustment.Upper );

                     if (this.scrollbar.Value == this.firstIndex)
                        return;
                    this.scrollbar.Value = this.firstIndex;
                    Console.WriteLine("this.firstIndex:{0} this.lastIndex:{1}", this.firstIndex, this.lastIndex);

                    #else
                    if (this.scrollBar.Maximum != MainSeries.Count - (this.lastIndex - this.firstIndex + 1) + this.scrollBar.LargeChange - 1)
                        this.scrollBar.Maximum = MainSeries.Count - (this.lastIndex - this.firstIndex + 1) + this.scrollBar.LargeChange - 1;
                    Console.WriteLine("scrollvalue:{0} min:{1} max:{2}", this.scrollBar.Value, this.scrollBar.Minimum, this.scrollBar.Maximum);

                    Console.WriteLine("this.firstIndex:{0} this.lastIndex:{1}", this.firstIndex, this.lastIndex);

                    if (this.scrollBar.Value == this.firstIndex)
                        return;
                    this.scrollBar.Value = this.firstIndex;
                    #endif
                }
                catch (Exception)
                {
                }
            }
        }