LayoutFarm.Text.InternalTextLayerController.SetCaretPos C# (CSharp) Méthode

SetCaretPos() public méthode

public SetCaretPos ( int x, int y ) : void
x int
y int
Résultat void
        public void SetCaretPos(int x, int y)
        {
            int j = textLineWriter.LineCount;
            if (j > 0)
            {
                EditableTextLine line = textLineWriter.GetTextLineAtPos(y);
                int calculatedLineId = 0;
                if (line != null)
                {
                    calculatedLineId = line.LineNumber;
                }
                this.CurrentLineNumber = calculatedLineId;
                this.textLineWriter.CaretXPos = x;
            }
        }
        public Rectangle CurrentLineArea

Usage Example

Exemple #1
0
        public void HandleMouseDown(UIMouseEventArgs e)
        {
            if (e.Button == UIMouseButtons.Left)
            {
                InvalidateGraphicOfCurrentLineArea();

                if (!e.Shift)
                {
                    internalTextLayerController.SetCaretPos(e.X, e.Y);
                    if (internalTextLayerController.SelectionRange != null)
                    {
                        Rectangle r = GetSelectionUpdateArea();
                        internalTextLayerController.CancelSelect();
                        InvalidateGraphicLocalArea(this, r);
                    }
                    else
                    {
                        InvalidateGraphicOfCurrentLineArea();
                    }
                }
                else
                {
                    internalTextLayerController.StartSelectIfNoSelection();
                    internalTextLayerController.SetCaretPos(e.X, e.Y);
                    internalTextLayerController.EndSelect();
                    InvalidateGraphicOfCurrentLineArea();
                }
            }
        }