How To Create Your Browser

Table of contents:

How To Create Your Browser
How To Create Your Browser

Video: How To Create Your Browser

Video: How To Create Your Browser
Video: Create Your Own Browser Using Python | Python Project | PyQt5 2024, December
Anonim

There are many who want to create a browser with their own hands. But everyone knows how to do it. It can be assembled using the standard CppWebBrowser component.

How to create your browser
How to create your browser

Instructions

Step 1

It's pretty easy to make a browser in Borland C ++ Builder v.6.0. You don't need to write your own engine. Use a ready-made internet explorer. Create a form and place the CppWebBrowzer element with internet tabs on it. He is on the far right. And add a button and edit button in order to enter the address. You will get a large white rectangle, in which the site page will be displayed. Describe the events by clicking on the button or in onEnter y edit`a: CppWebBrowser1-> Navigate (StringToOleStr (Edit1-> Text));. Now add some buttons that you are used to seeing in standard browsers. For example, these buttons can be: Back, Forward, Stop, and Home. Water codes for buttons: CppWebBrowser1-> GoBack (); - back button, CppWebBrowser1-> GoForward (); - forward button, CppWebBrowser1-> Stop (); - stop button, CppWebBrowser1-> Refresh (); - refresh button, CppWebBrowser1-> GoHome (); - home page button. Now replace the edit component with a ComboBox. It will record recently opened page addresses. Add some lines to the event handler: if (Key == VK_RETURN).

Step 2

In order to make tabs, you need a Pagecontrol. Place it on the form and right-click on it, in the menu that opens, click New Page. If you click again, you get a second tab. Go to the first tab and drag the CppWebBrowser component to it. Just drag it in the Object Treeview to TabSheet1. Now, to open a browser in each tab, add the Form1 component to the OnKeyDown handler: TCppWebBrowser * newbrowser.

Step 3

In order for the browser to expand when expanding, you need to add the Form1 component to the onCreate event: PageControl1-> Align = alClient. To show the buttons, place the CoolBar component on the tab. Then drag all the buttons onto it. Now put everything in order. To make changes in the address bar when switching from one page to another, add a line to the onBeforeNavigate2 event of the CppWebBrowser component: ComboBox1-> Text = CppWebBrowser1-> LocationURL.

Step 4

Now we need to create a single panel containing all the buttons, and so that it controls the active page. To do this, drag the CoolBar with all the elements onto the form. Styling the code for creating a tab into a separate function. Write the following in the header file, class TForm1, in the published section: void _fastcall make_tab ();. Then copy this function to onKeyDown. With this function, you make it easier for yourself to work with tabs. In order for the address bar to increase when expanding, go to the onResize component Form1 and enter: Form1-> ComboBox1-> Width = Form1-> Width - 150.

Step 5

The only thing left to do is to make the buttons transparent. To do this, load the images into FormCreate and add codes there that will help you set the transparency. Pick a transparency color and write it down. SpeedButton1-> Transparent = true; - transparency resolution, SpeedButton1-> Glyph-> Transparent = true; - indicates that the picture is with transparency, SpeedButton1-> Glyph-> TransparentColor = clBlack; - transparency color. Here, in FormCreate, add the make_tab (); command, that's all your browser is ready, you can launch it and work.

Recommended: