コード例 #1
0
        /// <summary>
        /// Initializes the scroll axis.
        /// </summary>
        /// <param name="scrollAxis">The scroll axis.</param>
        public void InitializeScrollAxis(ScrollAxisBase scrollAxis)
        {
            var pixelScrollAxis = scrollAxis as PixelScrollAxis;

            if (lineNested.Count > 0 && pixelScrollAxis == null)
            {
                throw new InvalidOperationException("When you have nested line collections you need to use PixelScrolling!");
            }

            //scrollAxis.distances.Clear();
            scrollAxis.DefaultLineSize = DefaultLineSize;
            scrollAxis.LineCount       = LineCount;

            foreach (RangeValuePair <double> entry in lineSizes)
            {
                if (entry.Value != -2)
                {
                    scrollAxis.SetLineSize(entry.Start, entry.End, entry.Value < 0 ? DefaultLineSize : entry.Value);
                }
            }

            foreach (KeyValuePair <int, LineSizeCollection> entry in lineNested)
            {
                pixelScrollAxis.SetNestedLines(entry.Key, entry.Value.Distances);
            }

            foreach (RangeValuePair <bool> entry in lineHidden)
            {
                scrollAxis.SetLineHiddenState(entry.Start, entry.End, entry.Value);
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PixelScrollAxis"/> class which
 /// is nested as a single line in a parent scroll axis.
 /// </summary>
 /// <param name="parentScrollAxis">The parent scroll axis.</param>
 /// <param name="sb">The scrollbar state.</param>
 /// <param name="scrollLinesHost">The scroll lines host.</param>
 /// <param name="distancesHost">The distances host.</param>
 public PixelScrollAxis(ScrollAxisBase parentScrollAxis, IScrollBar sb, ILineSizeHost scrollLinesHost, IDistancesHost distancesHost)
     : base(sb, scrollLinesHost)
 {
     // GridCellGridRenderer passes in Distances. LineSizeCollection holds them.
     // This allows faster construction of grids when they were scrolled out of view
     // and unloaded.
     this.parentScrollAxis = parentScrollAxis;
     this.distancesHost    = distancesHost;
     if (Distances == null)
     {
         throw new ArgumentNullException("Distances");
     }
 }