兄弟们,想请问一下,如何在一个richedit编辑框中屏蔽掉回车键,即按回车时不起任何作用,该如何做?
曾有牛人告诉我在keydown事件中
if key=13
then key:=0
不起作用,有哪位知道吗?
曾有牛人告诉我在keydown事件中
if key=13
then key:=0
不起作用,有哪位知道吗?
解决方案 »
- 多表联合查询4个表都有相同一个字段名,需要显示4个表的全部信息?
- 问一个sql语句?
- 用InstallShield打包的问题?
- 求助!!!!!
- 怎样在自己的程序里调用flashget 或netants
- 获取编辑框中的密码
- Delphi 连接 SqlServer 2000
- 为什么大家都用VCL呢?谁能给个WSOCK32。DLL的教程?
- 在dehpi中我想输出指定的内容到word的指定位置、如何在word的查找我的指定位置:@日期@ ?而且我想用剪贴板的内容代替他!谢谢各位大哥大
- 大调查,看谁编写"共享软件"赚的外块多.----------多多益善!!!!!!!!!!!!!!
- 怎样屏蔽一个kelphi窗口右上角的关闭按钮?
- 寻有投币机编程经验的朋友
if key=#13 then
key:=#0;
应该可以用
procedure TForm1.RichEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key = Char(VK_RETURN)) then Key := #0;
end;
{ Public declarations }
OldWndProc : TWndMethod;
procedure ReturnKeyProWnd(var Message: TMessage);
end;
...
procedure TForm1.FormCreate(Sender: TObject);
begin
OldWndProc := richedit1.WindowProc;
richedit1.WindowProc := ReturnKeyProWnd;
end;procedure TForm1.ReturnKeyProWnd(var Message: TMessage);
begin
if (message.Msg>=WM_KeyDown) and (Message.WParam=VK_Return) then begin
Message.Result := 1;
end else
OldWndProc(message);
end;