System.Windows.Forms.TextBoxBase.GetPositionFromCharIndex C# (CSharp) Method

GetPositionFromCharIndex() public method

public GetPositionFromCharIndex ( int index ) : Point
index int
return Point
		public virtual Point GetPositionFromCharIndex (int index)
		{
			return Point.Empty;
		}
		

Usage Example

 /// <remarks>
 /// GetCharIndexFromPosition is missing one caret position, as there is
 /// one extra caret position than there are characters (an extra one at
 /// the end). See http://stackoverflow.com/a/3874132.
 /// </remarks>
 public static int GetCaretIndex(TextBoxBase @this, Point point)
 {
     point = @this.PointToClient(point);
     var index = @this.GetCharIndexFromPosition(point);
     if (index == (@this.TextLength - 1))
     {
         var caretPoint = @this.GetPositionFromCharIndex(index);
         if (caretPoint.X < point.X) index += 1;
     }
     return index;
 }
All Usage Examples Of System.Windows.Forms.TextBoxBase::GetPositionFromCharIndex