关于 WebBrowser 问题(10分)

  • 主题发起人 主题发起人 孤独男孩
  • 开始时间 开始时间

孤独男孩

Unregistered / Unconfirmed
GUEST, unregistred user!
当用 WebBrowser 做一个浏览器时,

浏览网页输入文字时候,输入回车不能转行,

而用 ie 浏览就可以,

请问应该怎么办?

 
这个可能是BORLAND的错误了!
只有自己写代码转换了
把CHR(13)转化成<Br>应该就可以了
 
在窗体上放一个:ApplicationEvents控件,并在其OnMessage事件中写下面的代码:

procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
{ fixes the malfunction of some keys within webbrowser control }
const
StdKeys = [VK_TAB, VK_RETURN]; { standard keys }
ExtKeys = [VK_DELETE, VK_BACK, VK_LEFT, VK_RIGHT]; { extended keys }
fExtended = $01000000; { extended key flag }
begin
try
with Msg do
begin
//使WebBrowser响应回车键
//////////////////////////////////////////////////////////////////////////
Handled := False;
if ((Message >= WM_KEYFIRST) and (Message <= WM_KEYLAST)) and
((wParam in StdKeys) or
{$IFDEF VER120} (GetKeyState(VK_CONTROL) < 0) or {$ENDIF}
(wParam in ExtKeys) and
((lParam and fExtended) = fExtended)) then
begin
if IsChild(Handle, hWnd) then { handles all browser related messages }
begin
with {$IFDEF VER120}Application_{$ELSE}Application{$ENDIF} as IOleInPlaceActiveObject do
begin
Handled := TranslateAccelerator(Msg) = S_OK;
if not Handled then
begin
Handled := True;
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
end;
end;
end; //end of with
except
end; //end of try
end; // MessageHandler
 
接受答案了.
 
后退
顶部