在webbrowser里按回画没有反应,
很郁闷的一件事,有谁知道怎么解决?
让它能跟正常的IE一样工作。

解决方案 »

  1.   

    干脆你在onkeydow事件里处理了!!!
      

  2.   


      Problem:   Web forms that have multi-line text boxes and/or Submit buttons do not 
      respond to the Enter key when displayed on a TWebbrowser. 
      Also when browsing local folders, some keys don't respond.   How to solve it: 
    } unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, OleCtrls, ActiveX, StdCtrls, SHDocVw;type
      TForm1 = class(TForm)
        WebBrowser1: TWebBrowser;
        Button1: TButton;
        procedure FormDestroy(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations } 
        FOleInPlaceActiveObject: IOleInPlaceActiveObject; 
        procedure MsgHandler(var Msg: TMsg; var Handled: Boolean); 
      public 
        { Public declarations } 
      end; var 
      Form1: TForm1; 
    implementation {$R *.dfm} procedure TForm1.FormDestroy(Sender: TObject); 
    begin 
      FOleInPlaceActiveObject := nil;
    end;procedure TForm1.FormCreate(Sender: TObject); 
    begin 
      Application.OnMessage := MsgHandler;
      WebBrowser1.Navigate('www.google.com');
    end; procedure TForm1.MsgHandler(var Msg: TMsg; var Handled: Boolean); 
    const 
      DialogKeys: set of Byte = [VK_LEFT, VK_RIGHT, VK_BACK, $30..$39, $41..$5A]; 
    var
      iOIPAO: IOleInPlaceActiveObject; 
      Dispatch: IDispatch;
    begin
      { exit if we don't get back a webbrowser object } 
      if (WebBrowser1 = nil) then 
      begin 
        Handled := System.False; 
        Exit; 
      end;   Handled := (IsDialogMessage(WebBrowser1.Handle, Msg) = System.True);   if (Handled) and (not WebBrowser1.Busy) then 
      begin 
        if FOleInPlaceActiveObject = nil then 
        begin 
          Dispatch := WebBrowser1.Application; 
          if Dispatch <> nil then 
          begin 
            Dispatch.QueryInterface(IOleInPlaceActiveObject, iOIPAO); 
            if iOIPAO <> nil then 
              FOleInPlaceActiveObject := iOIPAO;
          end;
        end;     if FOleInPlaceActiveObject <> nil then 
          if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and 
            (Msg.wParam in DialogKeys) then 
            // nothing - do not pass on the DialogKeys 
          else 
            FOleInPlaceActiveObject.TranslateAccelerator(Msg); 
      end; 
    end;end.