自己发帖 也不百度以下 这个右击菜单的对了去了啊 //WebBrowser 中的右键菜单//先要添加ApplicationEvents1,指定其Message事件//屏蔽右键菜单procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);begin with Msg do begin if not IsChild(WebBrowser1.Handle, hWnd) then Exit; Handled := (message = WM_RBUTTONDOWN) or (message = WM_RBUTTONUP) or (message = WM_CONTEXTMENU); end;end;//替换右键菜单procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);var mPoint: TPoint;begin if IsChild(WebBrowser1.Handle, Msg.Hwnd) and ((Msg.Message = WM_RBUTTONDOWN) or (Msg.Message = WM_RBUTTONUP)) then begin GetCursorPos(mPoint); //得到光标位置 PopupMenu1.Popup(mPoint.X, mPoint.Y); //弹出popupmenu1的菜单 Handled:=True; end;end;--------------------------------------------------------------------------------//新页面写入begin WebBrowser1.Navigate('about:blank'); WebBrowser1.OleObject.Document.Writeln('ok');end;//从流中写入:var ms: TMemoryStream;begin ms := TMemoryStream.Create; Memo1.Lines.SaveToStream(ms); ms.Position := 0; (WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(ms)); ms.Free;end;//禁止提示脚步错误procedure TForm1.WebBrowser1NavigateComplete2(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);begin WebBrowser1.Silent := True;end;//禁止弹出窗口procedure TForm1.WebBrowser1NewWindow2(ASender: TObject; var ppDisp: IDispatch; var Cancel: WordBool);begin Cancel := True;end;