ClayB wrote:
Try using
Point pt =
richtextBox1.GetPositionFromCharIndex(richtextBox1 .SelectionStart);
=============
Clay Burch
Yes. I found the following:
public class cPosition
{
int x, y;
public int X
{
get
{
return x;
}
set
{
x = value;
}
}
public int Y
{
get
{
return y;
}
set
{
y = value;
}
}
}
//Declare the SendMessage:
public class Win32
{
public Win32()
{
//
// TODO: Add constructor logic here
//
}
[DllImport("User32.Dll")]
public static extern int SendMessage(IntPtr hWnd,int Msg,int
wParam,int lParam);
public const int EM_LINEINDEX = 0xBB;
}
private cPosition CursorPosition() //ref int x, ref int y)
{
int ColIndex;
int RowIndex;
int RowStartIndex;
cPosition cpos;
RowIndex = Memo1.GetLineFromCharIndex(Memo1.SelectionStart)+1 ;
Memo1.GetCharIndexFromPosition(Memo1.GetPositionFr omCharIndex(Memo1.Sele
ctionStart));
RowStartIndex = Win32.SendMessage(Memo1.Handle,
Win32.EM_LINEINDEX, -1, 0);
ColIndex = Memo1.SelectionStart-RowStartIndex+1;
cpos = new cPosition();
cpos.X = ColIndex;
cpos.Y = RowIndex;
return cpos;
}
--
Don Gollahon