示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LineScrollAxis"/> class.
        /// </summary>
        /// <param name="sb">The state of the scrollbar.</param>
        /// <param name="scrollLinesHost">The scroll lines host.</param>
        public LineScrollAxis(IScrollBar sb, ILineSizeHost scrollLinesHost)
            : base(sb, scrollLinesHost)
        {
            var distancesHost = scrollLinesHost as IDistancesHost;

            distances = distancesHost != null ? distancesHost.Distances : new DistanceRangeCounterCollection();
            if (scrollLinesHost != null)
            {
                scrollLinesHost.InitializeScrollAxis(this);
            }
            distances.DefaultDistance = 1.0;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PixelScrollAxis"/> class.
 /// </summary>
 /// <param name="sb">The scrollbar state.</param>
 /// <param name="scrollLinesHost">The scroll lines host.</param>
 /// <param name="distancesHost">The distances host.</param>
 public PixelScrollAxis(IScrollBar sb, ILineSizeHost scrollLinesHost, IDistancesHost distancesHost)
     : base(sb, scrollLinesHost)
 {
     if (distancesHost != null)
     {
         this.distancesHost = distancesHost;
     }
     else if (scrollLinesHost != null)
     {
         this.distances = new DistanceRangeCounterCollection
         {
             DefaultDistance = scrollLinesHost.GetDefaultLineSize()
         };
         scrollLinesHost.InitializeScrollAxis(this);
     }
     if (Distances == null)
     {
         throw new ArgumentNullException("Distances");
     }
 }