定义光标在文本框中的哪一行 [英] defining on which line the cursor is in a textbox

查看:53
本文介绍了定义光标在文本框中的哪一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




对于我的应用程序,我需要以下行为:当我按F4时光标

必须移动到我的多行中的下一行以0开头的文本框。


查找以0开头的行并不困难,但找到下一行

行更难。例如:如果我的光标在第200行,则必须

开始在第201行搜索,而不是在第1行。


任何人都有任何想法?


我想把光标放在我所依赖的留置权上也是我需要的东西,所以如果有人知道如何做到这一点...... :-)


Thansk提前很多,


Pieter

Hi,

For my application I need the following behavior: When I press F4 the cursor
has to move to the next line in my multiline textbox which begins with "0".

Finding lines starting with 0 isn''t that difficult, but to find the next
line is more difficult. For exemple: if my cursor is on line 200, it has to
start searching on line 201, and not on line 1.

Anybody has any ideas?

I guess that posotioning the cursor on the lien I foudn is also something I
will need, so if somebody knows how to do that... :-)

Thansk a lot in advance,

Pieter

推荐答案




据我记忆,这可以在API级别完成。看一下

文本框消息(从EM_前缀开始),特别是EM_LINEFROMCHAR

和EM_LINEINDEX。


- -

Dmitriy Lapshin [C#/ .NET MVP]

X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx

带来对VS .NET IDE进行单元测试的能力

" DraguVaso" < PI ********** @ hotmail.com>在消息中写道

news:40 ********************** @ news.skynet.be ...
Hi,

As far as I remember, this can be done at the API level. Take a look at the
text box messages (starting with the EM_ prefix), especially EM_LINEFROMCHAR
and EM_LINEINDEX.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:40**********************@news.skynet.be...


对于我的应用程序,我需要以下行为:当我按F4时,
光标必须移动到我的多行文本框中以
开头的下一行0。
找到以0开头的行并不困难,但找到下一行更难。例如:如果我的光标在第200行,它有
开始在第201行搜索,而不在第1行。

有人有任何想法吗?
我想把光标放在我所说的留置权上也是我需要的
,所以如果有人知道怎么做...... :-)

Thansk提前很多,
Hi,

For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0".
Finding lines starting with 0 isn''t that difficult, but to find the next
line is more difficult. For exemple: if my cursor is on line 200, it has to start searching on line 201, and not on line 1.

Anybody has any ideas?

I guess that posotioning the cursor on the lien I foudn is also something I will need, so if somebody knows how to do that... :-)

Thansk a lot in advance,

Pieter






嗨彼得,

$ b你找不到

textbox.lines


有些东西(大致写在这里未经过测试,从未尝试过)

\\ \\\\\

for i as integer = 200 to textbox1.lines.length-1

if x ........... .....

next

////

我希望这有帮助吗?


cor

Hi Pieter,

Did you look for
textbox.lines

Something as (roughly written here not tested and never tried)
\\\\
for i as integer = 200 to textbox1.lines.length-1
if x................
next
////
I hope this helps?

Cor

对于我的应用程序,我需要以下行为:当我按F4时,
光标必须移动到我的多行文本框中的下一行开始
" 0"
Findin从0开始的g行并不难,但要找到下一行更难。例如:如果我的光标在第200行,它有
开始在第201行搜索,而不在第1行。

有人有任何想法吗?
我想将光标放在留置权上我也需要
,所以如果有人知道怎么做......: - )
For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0".
Finding lines starting with 0 isn''t that difficult, but to find the next
line is more difficult. For exemple: if my cursor is on line 200, it has to start searching on line 201, and not on line 1.

Anybody has any ideas?

I guess that posotioning the cursor on the lien I foudn is also something I will need, so if somebody knows how to do that... :-)



*" DraguVaso" < PI ********** @ hotmail.com> scripsit:
* "DraguVaso" <pi**********@hotmail.com> scripsit:
对于我的应用程序,我需要以下行为:当我按F4时,光标
必须移动到我的多行文本框中以0开头的下一行。找到以0开头的行并不困难,但要找到下一行
就更难了。例如:如果我的光标在第200行,它必须开始在201行开始搜索,而不是在第1行。
For my application I need the following behavior: When I press F4 the cursor
has to move to the next line in my multiline textbox which begins with "0".

Finding lines starting with 0 isn''t that difficult, but to find the next
line is more difficult. For exemple: if my cursor is on line 200, it has to
start searching on line 201, and not on line 1.




快速和脏:使用循环并循环遍历文本框'''Lines''

属性并总结行的长度(+行的长度

分隔符) 。然后使用重载版本的

设置位置文本框的''选择''方法。


-

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>



Quick and dirty: Use a loop and loop through the textbox''s ''Lines''
property and sum up the length of the lines (+ the length of the line
separator). Then set the position by using the overloaded version of
the textbox''s ''Select'' method.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


这篇关于定义光标在文本框中的哪一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆