删除前一个字符 [英] delete preceding character
问题描述
朋友,
我正在开发一些印度语言支持工具,该工具用于使用ttf字体打印Devnagari(印度语言)字符.我已经尝试执行以下任务,但没有成功
A.无法删除C#中的前一个字符
我已经编写了以下代码来删除前一个字符
1.使用键盘事件(user32.dll中的Keybd_event)
我需要删除字符而不使用BACKSPACE KEY.
keybd_event(8,0x0E,0,UIntPtr.Zero);
keybd_event(8,0x8E,2,UintPtr.Zero);
问题:当我使用键盘事件时,它将调用BackSpace键.我已经使用了Keyboard的低级钩子.我需要删除前面的字符而不使用BackSpace键.
2.我使用SendKey尝试的第二种方法
代码:SendKeys.Send("{BACKSPACE}");
但是在非托管代码中,它不能很好地工作.
我们可以使用SendMessage/SendInput,TranslateMessege或其他方法剪切前面的字符吗?
非常感谢您的帮助:)
Hi Friends,
i am developing some indian language supporting tool that is used to print Devnagari (An indian language) character using ttf font. I have tried for following task but it is not get much successful
A. Unable to delete preceding character in C#
I have written following code to delete preceding character
1. Using Keyboard Event(Keybd_event in user32.dll)
I Required to delete the character without using BACKSPACE KEY.
keybd_event(8, 0x0E, 0, UIntPtr.Zero);
keybd_event(8, 0x8E, 2, UintPtr.Zero);
Problem : When I used Keyboard Event it calls BackSpace Key. I have used low level hook of Keyboard . I require to delete the preceding character without using BackSpace key.
2. Second Method I Tried using SendKey
Code: SendKeys.Send("{BACKSPACE}");
But it is not working well in unmanaged code.
Can we cut preceding character with SendMessage/ SendInput, TranslateMessege or other method ?
Any help is greatly appreciated :)
推荐答案
首先,没有"Devnagari"之类的东西.您的意思是梵文.这不是一种语言.参见 http://en.wikipedia.org/wiki/Devanagari [ http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx [
To start with: there is no such thing as "Devnagari". What you mean is called Devanagari; and this is not a language. See http://en.wikipedia.org/wiki/Devanagari[^].
This is alphabet used by many Indian languages, but not only Indian.
Simulation of key presses is a dirty thing. It means you failed to develop UI properly and looking for a dirty work-around. It can be legitimately used when the key presses themselves are of the interest, for example, playing keyboard macro, virtual keyboards. By the way,keybd_event
is superseded by more comprehensiveSendInput
, see http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[^].
Your task should be solved by manipulations with strings instead. You did not provide enough information to give you more detail, but such techniques are trivial.
—SA
这篇关于删除前一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!