Exemplo n.º 1
0
        private void qScrollBar_ScrollSkip(bool Up)
        {
            int fvi = Math.Max(1, FirstVisibleItem);

            if (Up)
            {
                fvi--;
            }

            if ((Up || Values.Count > fvi) && (!Up || fvi > 0))
            {
                char c  = Lib.FirstCharNoTheUpper(Values[fvi]);
                char c2 = c;
                Func <string, char> getChar = GetFilterChar();

                if (c != ' ')
                {
                    if (Up)
                    {
                        do
                        {
                            fvi--;
                            c = c2;
                        }while (fvi > 1 && c == (c2 = getChar(Values[fvi - 1])));

                        FirstVisibleItem = Math.Min(fvi, FirstVisibleItem - 1);
                    }
                    else
                    {
                        char min = 'A';
                        int  max = Values.Count - NumVisibleItems + 1;
                        do
                        {
                            fvi++;
                            c = c2;
                        }while (fvi < max && ((c == (c2 = getChar(Values[fvi + 1]))) || (c2 < min)));

                        FirstVisibleItem = Math.Max(fvi + 1, FirstVisibleItem - 1);
                    }
                }
                if (FirstVisibleItem > 0)
                {
                    controller.ShowLetter(getChar(Values[FirstVisibleItem]));
                }
            }
        }