Muaj ntau tus neeg uas xav tsim lub browser nrog lawv tus kheej tes. Tabsis txhua tus paub yuav ua li cas. Nws tuaj yeem sib dhos siv tus qauv CppWebBrowser tivthaiv.
Cov Lus Qhia
Kauj ruam 1
Nws yooj yim zoo nkauj los ua lub browser hauv Borland C ++ Builder v.6.0. Koj tsis tas yuav sau koj tus kheej lub tshuab. Siv ib tus pib npaj siv internet tshawb. Tsim ib daim ntawv thiab tso CppWebBrowzer caij nrog internet tab nyob rau nws. Nws nyob ntawm sab xis. Thiab ntxiv ib lub pob thiab kho pob kom hloov chaw nyob. Koj yuav tau txais ib lub duab plaub loj dawb, hauv cov nplooj ntawv tso rau pom. Piav qhia txog cov xwm txheej los ntawm nyem lub pob lossis hauv onEnter y edit`a: CppWebBrowser1-> Tsav (StringToOleStr (Edit1-> Cov Ntawv)); Tam sim no ntxiv qee qhov khawm uas koj siv los pom hauv cov browsers zoo. Piv txwv li, cov nyees khawm no tuaj yeem yog: Rov Qab, Rov Los, Nres, thiab Tsev. Dej cim rau khawm: CppWebBrowser1-> GoBack (); - khawm rov qab, CppWebBrowser1-> GoForward (); - rau pem hauv ntej khawm, CppWebBrowser1-> Nres (); - nres khawm, CppWebBrowser1-> Refresh (); - khawm tshiab, CppWebBrowser1-> GoHome (); - home page khawm. Tam sim no hloov cov ntawv kho kom raug nrog ComboBox. Tsis ntev los no qhib phab chaw nyob yuav raug kaw hauv nws. Ntxiv ib co kab ntxiv rau tus tuav kev tshwm sim: yog tias (Key == VK_RETURN).
Kauj ruam 2
Txhawm rau ua cov tabs, koj xav tau Pagecontrol. Tso nws rau ntawm daim ntawv thiab nyem-thov nws, hauv cov ntawv qhia zaub mov uas qhib, nyem Tshiab Tshiab. Yog tias koj nyem qhov rov qab, koj tau txais kab thib ob. Mus rau thawj kab thiab cab tus CppWebBrowser tivthaiv rau nws. Tsuas yog luag nws nyob rau hauv Object Treeview rau TabSheet1. Tam sim no, txhawm rau qhib qhov browser hauv txhua kab, ntxiv cov Form1 tivthaiv rau OnKeyDown handler: TCppWebBrowser * newbrowser.
Kauj ruam 3
Txhawm rau kom qhov browser nthuav dav thaum nthuav dav, koj yuav tsum ntxiv Daim Ntawv Qhia Form1 rau qhov kev tshwm sim onCreate: PageControl1-> Dlhos = alClient Txhawm rau qhia cov nyees khawm, muab cov CoolBar tivthaiv rau ntawm lub tab. Tom qab ntawd luag tag nrho cov nyees khawm mus rau nws. Tam sim no muab txhua yam tso rau kev txiav txim. Txhawm rau hloov pauv chaw nyob chaw nyob thaum hloov los ntawm ib nplooj ntawv mus rau lwm nplooj, ntxiv ib txoj kab rau onBeforeNavigate2 kev tshwm sim ntawm CppWebBrowser tivthaiv: ComboBox1-> Cov Ntawv = CppWebBrowser1-> LocationURL.
Kauj ruam 4
Tam sim no peb yuav tsum tsim kom muaj tib lub vaj huam sib luag uas muaj tag nrho cov nyees khawm thiab kom nws tswj hwm cov nplooj ntawv ua haujlwm. Ua li no, rub lub CoolBar nrog rau tag nrho cov ntsiab mus rau hauv daim ntawv. Styling cov cai rau tsim lub tab rau hauv nyias muaj nyias nuj nqi. Sau cov hauv qab no rau hauv cov ntawv header, class TForm1, hauv seem luam tawm: tsis lees _fastcall make_tab (); Tom qab ntawv theej no ua haujlwm rau onKeyDown. Nrog rau txoj haujlwm no, koj ua kom yooj yim rau koj tus kheej los ua haujlwm nrog cov tabs. Txhawm rau qhov chaw nyob bar nce ntxiv thaum nthuav dav ntxiv, mus rau ntawm onResize tivthaiv Form1 thiab nkag mus: Form1-> ComboBox1-> Dav = Form1-> Dav - 150.
Kauj ruam 5
Tib qho tsim nyog ua yog ua kom cov nyees khawm pob tshab. Ua li no, thauj cov duab rau hauv FormCreate thiab ntxiv cov lej nyob ntawd uas yuav pab koj teeb tsa qhov ua kom pom zoo. Khaws cov xim pob tshab thiab sau nws cia. SpeedButton1-> Pob tshab = qhov tseeb; - kev ua kom pom tseeb, SpeedButton1-> Glyph-> Pob tshab = qhov tseeb; - qhia tias daim duab nrog pob tshab, SpeedButton1-> Glyph-> TransparentColor = clBlack; - pob tshab xim. Ntawm no hauv FormCreate ntxiv qhov make_tab (); cov lus txib, uas yog txhua yam koj lub browser npaj txhij, koj tuaj yeem pib nws thiab ua haujlwm.