我想实现 的效果是我在webbrowser中加载了一个index.htm网页上面有一幅图片 我想让点击图片时弹出delphi的form窗体  最好给出代码:谢谢

解决方案 »

  1.   

    可能要把Form做成ActiveX才行,但这样IE会有安全性的提示
      

  2.   

    通过提取url,来弹出窗口。.现在很多软件都这么做。procedure TfrmNav.WebBrowser1BeforeNavigate2(Sender: TObject;
      const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
      Headers: OleVariant; var Cancel: WordBool);
    begin
    cancel:=LinkToMenu(url);
    end;
    function  TfrmNav.LinkToMenu(Aurl:string):boolean;
    begin
    result:=false;
       if pos('@department',Aurl)>0 then  mainfrm.N12.Click
         else if pos('@employees',Aurl)>0 then  mainfrm.N13.Click
           else if pos('@testofemp',Aurl)>0 then  mainfrm.N14.Click
             else if pos('@daycheckin',Aurl)>0 then  mainfrm.N15.Click
               else if pos('@monthcheckin',Aurl)>0 then  mainfrm.N16.Click
                 else if pos('@sumcheckin',Aurl)>0 then  mainfrm.N28.Click
                   else if pos('@holidaynote',Aurl)>0 then  mainfrm.N19.Click
                     else if pos('@holidaysdef',Aurl)>0 then  mainfrm.N22.Click
                       else if pos('@workonandofftime',Aurl)>0 then  mainfrm.N18.Click
                         else if pos('@checkinrulesdef',Aurl)>0 then  mainfrm.N17.Click
                           else if pos('@holidaysrulesdef',Aurl)>0 then  mainfrm.yge1.Click
                             else if pos('@todayeatinfo',Aurl)>0 then  mainfrm.n29.Click
                               else if pos('@eatinfo',Aurl)>0 then  mainfrm.n30.Click
                                 else if pos('@logisticsrulesdef',Aurl)>0 then  mainfrm.n31.Click
                                   else if pos('@jjnote',Aurl)>0 then  mainfrm.n23.Click
                                     else if pos('@jsnote',Aurl)>0 then  mainfrm.n39.Click
                                       else if pos('@unitinfo',Aurl)>0 then  mainfrm.n24.Click
                                         else if pos('@salarydetail',Aurl)>0 then  mainfrm.n25.Click
                                           else if pos('@salarysum',Aurl)>0 then  mainfrm.N26.Click
                                             else if pos('@machinedef',Aurl)>0 then  mainfrm.N33.Click
                                               else if pos('@mangather',Aurl)>0 then  mainfrm.N34.Click
                                                 else if pos('@cardmanage',Aurl)>0 then  mainfrm.N36.Click
                                                   else if pos('@userinfo',Aurl)>0 then  mainfrm.N7.Click
                                                     else if pos('@changepassword',Aurl)>0 then  mainfrm.N32.Click
                                                       else if pos('@databasebackup',Aurl)>0 then  mainfrm.N8.Click
                                                         else if pos('@quit',Aurl)>0 then  mainfrm.N9.Click
                                                           else exit;
    result:=true;
    end;