示例#1
0
        /// <summary>
        /// Called by the control's internal sizing mechanism.
        /// Returns the rectangle for a scroll button.
        /// </summary>
        /// <param name="buttonType">The scroll button to
        /// get the rectangle for.</param>
        /// <param name="selectedGroup">The Selected Group in the control.</param>
        /// <param name="internalGroupHeight">The internal height of the
        /// selected group</param>
        /// <returns>The Rectangle for the scroll button.</returns>
        protected override Rectangle GetScrollButtonRectangle(
            ListBarScrollButton.ListBarScrollButtonType buttonType,
            ListBarGroup selectedGroup,
            int internalGroupHeight
            )
        {
            Point location;
            Size  size = new Size(
                selectedGroup.ButtonHeight,
                selectedGroup.ButtonHeight);
            bool rightToLeft = (base.RightToLeft == RightToLeft.Yes);
            int  left        = (rightToLeft ?
                                selectedGroup.ButtonLocation.X - size.Width - 2 :
                                selectedGroup.ButtonLocation.X + selectedGroup.ButtonWidth + 2
                                );

            if (buttonType == ListBarScrollButton.ListBarScrollButtonType.Up)
            {
                location = new Point(
                    left,
                    selectedGroup.ButtonLocation.Y);
            }
            else
            {
                // is selectedGroup the last visible item in the control?
                ListBarGroup nextGroup = GetNextGroup(selectedGroup);

                location = new Point(
                    left,
                    (nextGroup == null ?
                     selectedGroup.ButtonLocation.Y + selectedGroup.ButtonHeight + internalGroupHeight - size.Height :
                     nextGroup.ButtonLocation.Y));
            }

            return(new Rectangle(location, size));
        }
示例#2
0
 /// <summary>
 /// Creates a new instance of a <see cref="ListBarScrollButton"/> used by
 /// this control to draw the scroll buttons.  Fired during control initialisation
 /// </summary>
 /// <param name="buttonType">The type of scroll button (Up or Down)
 /// to create</param>
 /// <returns>A new <see cref="ListBarScrollButton"/> which is drawn when a
 /// <see cref="ListBarGroup"/> contains more items than can be
 /// displayed.</returns>
 protected override ListBarScrollButton CreateListBarScrollButton(
     ListBarScrollButton.ListBarScrollButtonType buttonType)
 {
     return(new VSNetListBarScrollButton(this, buttonType));
 }