ClayB wrote:
Try using
Point pt =
richtextBox1.Ge tPositionFromCh arIndex(richtex tBox1.Selection Start);
=============
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("User 32.Dll")]
public static extern int SendMessage(Int Ptr 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.GetLineFr omCharIndex(Mem o1.SelectionSta rt)+1;
Memo1.GetCharIn dexFromPosition (Memo1.GetPosit ionFromCharInde x(Memo1.Sele
ctionStart));
RowStartIndex = Win32.SendMessa ge(Memo1.Handle ,
Win32.EM_LINEIN DEX, -1, 0);
ColIndex = Memo1.Selection Start-RowStartIndex+1 ;
cpos = new cPosition();
cpos.X = ColIndex;
cpos.Y = RowIndex;
return cpos;
}
--
Don Gollahon