请问如何在Edit中实现屏蔽中文输入法!(20分)

  • 主题发起人 主题发起人 阿西喊佛
  • 开始时间 开始时间

阿西喊佛

Unregistered / Unconfirmed
GUEST, unregistred user!
请问如何在Edit中实现屏蔽中文输入法!
也就是说无论怎么点,怎么搞都只有纯英文输入。
就象大富翁登陆时的密码输入一样,谢了!
 
Edit.ImeMode = imDisable;
 
是吗,可是当鼠标再点击的时候还是会出现呀,这又该怎么办呢?
 
各位同仁志士帮帮忙呀~
好痛苦的问题,困扰了我n久了。
 
procedure TForm1.Edit1Enter(Sender: TObject);
begin
Edit1.ImeMode := imClose;
end;
 
在Edit1的OnChange事件中判断是否有是汉字的,如果有把汉字清除。
 
同意楼上思路:)
 
那么joky1981能否给出源码,谢了。
 
那么joky1981能否给出源码,谢了。
 
imDisable 对中文不起作用的。

imDisable Shut down the IME. imDisable has no effect on Chinese, Taiwanese, or Korean IMEs.
imClose Close the IME conversion window, but leave the IME running in the background. The IME can be re-activated by a hot key combination.
imOpen Open the IME conversion window. The conversion mode is the last conversion mode used by the IME.
imDontCare Launch the IME if it is disabled. The conversion mode is the last conversion mode used by the IME.
imSAlpha Open the IME conversion window and set the conversion mode to accept single-width Roman alphabet input.

imAlpha Open the IME conversion window and set the conversion mode to accept double-width Roman alphabet input.
imHira Open the IME conversion window and set the conversion mode to double-width Hiragana. imHira is only available for Japanese IMEs.
imSKata Open the IME conversion window and set the conversion mode to single-width Katakana (Hankaku Katakana). imSKata is only available for Japanese IMEs.
imKata Open the IME conversion window and set the conversion mode to double-width Katakana (Zenkaku Katakana). imKata is only available for Japanese IMEs.

imChinese Open the IME conversion window and set the conversion mode to double-width Chinese. imChinese is only available for Chinese IMEs.
imSHanguel Open the IME conversion window and set the conversion mode to single-width Hanguel. imSHanguel is only available for Korean IMEs.
imHanguel Open the IME conversion window and set the conversion mode to double-width Hanguel. imHanguel is only available for Korean IMEs.
 
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['a'..'z','A'..'Z',#8]) then
key := #0;
end;
// #8为Back Space
 
uses ...ime;
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
myhkl:hkl;
begin
myhkl:=GetKeyBoardLayOut(0);
//判断是否在中文状态,若是则关闭它
if ImmIsIME(myhkl) then
immsimulateHotkey(handle,IME_CHotKey_IME_NonIME_Toggle);
end;
 
上面的控制方法都不能保证通过剪贴板传过来的汉字

也许可以通过tmaskedit来实现
或者在tedit.onchange中写代码来实现
 
多人接受答案
 
后退
顶部