1
Vote

Fix to reverse default scrollbar behavior where Value cannot reach Maximum

description

Change Calendar.DayView
 
    public void ScrollMe(bool down)
    {
        if (this.AllowScroll == false)
            return;
 
        int newScrollValue;
 
        if (down)
        {//mouse wheel scroll down
            newScrollValue = this.scrollbar.Value + this.scrollbar.SmallChange;
 
            if (newScrollValue < this.scrollbar.Maximum - scrollbar.LargeChange + 1) // Fix
                this.scrollbar.Value = newScrollValue;
            else
                this.scrollbar.Value = this.scrollbar.Maximum - scrollbar.LargeChange + 1; // Fix
        }
 
and
 
    private void AdjustScrollbar()
    {
        int offset = (2 * appointmentSlotHeight * 24) - this.Height + this.HeaderHeight; // With this fix, don't need to show 25th hour. Changed to 24.
        if (offset <= 0) // Added feature to disable scrollbar when there is no need to scroll
        {
            scrollbar.Value = 0;
            scrollbar.Enabled = false;
        }
        else
        {
            scrollbar.Enabled = true;
        }
 
        scrollbar.Maximum = offset + scrollbar.LargeChange - 1; // Fix to reverse default scrollbar behavior
        scrollbar.Minimum = 0;
    }

comments