Atspi.Text.SetSelection C# (CSharp) Метод

SetSelection() публичный Метод

public SetSelection ( int selectionNum, int startOffset, int endOffset ) : bool
selectionNum int
startOffset int
endOffset int
Результат bool
        public bool SetSelection(int selectionNum, int startOffset, int endOffset)
        {
            return proxy.SetSelection (selectionNum, startOffset, endOffset);
        }

Usage Example

Пример #1
0
        public void RemoveFromSelection()
        {
            if (!accessible.StateSet.Contains(StateType.Enabled))
            {
                throw new ElementNotEnabledException();
            }

            int nSelections = text.NSelections;

            for (int i = 0; i < nSelections; i++)
            {
                int  start, end;
                bool set = false;
                text.GetSelection(i, out start, out end);
                if (startOffset > start && startOffset < end)
                {
                    startOffset = end;
                    set         = true;
                }
                if (endOffset > start && endOffset < end)
                {
                    endOffset = start;
                    set       = true;
                }
                if (set)
                {
                    if (endOffset < startOffset)
                    {
                        text.RemoveSelection(i);
                        i--;
                    }
                    else
                    {
                        text.SetSelection(i, startOffset, endOffset);
                    }
                    set = false;
                }
            }
        }