如何在CGridCtrl单元格中移动光标位置 [英] How to move the Cursor position in a CGridCtrl Cell
本文介绍了如何在CGridCtrl单元格中移动光标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用CGridCtrl,并且想要在单元格中移动光标位置.
我该怎么办?
感谢您的帮助
Martin
Hi,
I use CGridCtrl and I want to move the Cursor position in a Cell.
How can i do this?
thanks for help
Martin
推荐答案
尝试一下:):
Try it :) :
{
...
CRect cCellRect;
GetCellRect(iRow, iCol, cCellRect);
if (ClientToScreen(cCellRect)) {
SetCursorPos(cCellRect.left +1,
cCellRect.top +1);
}
...
}
Mt Morph写道:
Mt Morph wrote:
但是有noch函数GetCellRect(iRow,iCol,cCellRect)
but there is noch function GetCellRect(iRow,iCol,cCellRect)
你为什么这样想? :)
Why are you thinking so ? :)
Mt Morph写道:
Mt Morph wrote:
现在我希望光标位于这两个单词之间吗?
Now i want the cursor being between these both words ?
这将是正确的结果吗? :):
Would it be a correct result ? :) :
CGridCellBase* pcCell = GetCell(GetFocusCell());
if (pcCell) {
CEdit* pcEdit = DYNAMIC_DOWNCAST(CEdit, pcCell->GetEditWnd());
if (pcEdit) {
pcEdit->SetSel(5, 5);
}
}
好吧,算了,我发现了这个函数;)
问题是,有了您的答案,我就可以移动光标.
我认为我指定的问题有点不对.
我想在单元格中移动editcursor.
例如:
该单元格包含文本"Hello World".如果单元格获得焦点,则编辑光标将位于文本的最后位置. ->"Hello World |"
现在,我希望光标位于这两个词之间.
那就是我的问题.
Ok, forget it I found the function ;)
The problem is that with your answer i can Move the cursor.
I think I specified the problem a little bit wrong.
I want to move the editcursor in a cell.
For example:
The cell contains the Text "Hello World ". If the Cell gets the focus the editcursor is on the last position of the text. -> "Hello World |"
Now i want the cursor being between these both words.
Thats my problem.
这篇关于如何在CGridCtrl单元格中移动光标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文