edit控件
怎么让光标移动到指定位置 问题点数:60、回复次数:9Top
1 楼lzd(活着便精彩)回复于 2002-11-25 12:59:39 得分 5
GetDlgItem(IDC_XXX)->SetFocus();Top
2 楼zhaolaoxin()回复于 2002-11-25 13:00:43 得分 10
m_edit.SetSel()
Top
3 楼kingcom_xu(冷羽)回复于 2002-11-25 13:06:45 得分 20
m_edit1.SetFocus();
m_edit1.SetWindowText("aaaaaaaaaaaaaa");
m_edit1.SetSel(2,2);Top
4 楼Saimen(沉默是金)回复于 2002-11-25 13:08:52 得分 0
yesTop
5 楼Rayanywhere()回复于 2002-11-25 14:00:54 得分 0
谢了 给分!Top
6 楼Rayanywhere()回复于 2002-11-25 14:14:21 得分 0
顺便问一下,要移动到最后该怎么得到他的positionTop
7 楼Rayanywhere()回复于 2002-11-25 14:15:43 得分 0
顺便问一下,要移动到最后该怎么得到他的positionTop
8 楼kingcom_xu(冷羽)回复于 2002-11-25 14:33:39 得分 15
m_edit1.SetWindowText("bbbbb");
m_edit1.SetFocus();
CString str;
m_edit1.GetWindowText(str);
m_edit1.SetSel(str.GetLength(),str.GetLength());Top
9 楼Saimen(沉默是金)回复于 2002-11-25 14:34:55 得分 10
//移动编辑窗口光标到最后
void CDockPadDlg::MoveEditCurToEnd()
{
UINT nBufLength;
nBufLength = m_strEditText.GetLength();
m_editCtrl.SetSel(nBufLength,nBufLength,FALSE);
}
CEdit::GetSel
DWORD GetSel( ) const;
void GetSel( int& nStartChar, int& nEndChar ) const;
Return Value
The version that returns a DWORD returns a value that contains the starting position in the low-order word and the position of the first nonselected character after the end of the selection in the high-order word.
Parameters
nStartChar
Reference to an integer that will receive the position of the first character in the current selection.
nEndChar
Reference to an integer that will receive the position of the first nonselected character past the end of the current selection.
Remarks
Call this function to get the starting and ending character positions of the current selection (if any) in an edit control, using either the return value or the parameters.
For more information, seeEM_GETSEL in the Win32 documentation
Top




