Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C# helpp


buddywithgol's Avatar
Member
0 0

i'am trying to create a simple web browser, but a problem is that when the user resize the form some of my Control are not visible. I want it to be like google chrome, like how when u resize the form everything is visible

Like this:

Any idea how to achieve this.


chess_rock's Avatar
Member
0 0

You have to dock your browser view below your navigation bar and anchor it at the top of the tab panel


Arabian's Avatar
Member
0 0

Doesn't C++ have somwhere you may specify the action of a bar/panel/script/message, such as some 'fill-parent' setting in your schemas?

What libs are you using?


buddywithgol's Avatar
Member
0 0

I've tried but every time i anchored them the control stretch out over one on another.


Arabian's Avatar
Member
0 0

Give us a link to your code


ellipsis's Avatar
...
0 -1

buddywithgol wrote: i'am trying to create a simple web browser, but a problem is that when the user resize the form some of my Control are not visible. I want it to be like google chrome, like how when u resize the form everything is visible

Any idea how to achieve this.

Use a verticle split container to hold your navigational controls. Use the lower part of the container to hold your webbrowser.

Make the split container dock to the center so everything stays where it should. The only problem is I have no idea how you would keep the buttons set as you decrease the width of the form. You could use locked panels to keep the buttons where they should be but put a panel in the center with the url textbox so it can expand when the width of the form changes.

Who knows? Just fuck around with it. Those were off the top of my head and I don't feel like opening Visual Studio just to test my hypothesis.

What all have you tried? P.S. I like your button images. After you get all of this done, create a history flatfile, a way to clear the history, and so forth. Also, make the url textbox a combobox so you can visit previous urls by adding the urls as they come to the items in the combobox.

It looks super rad! Send an archived release when you are finished! Keep up your good work and be creative!


ellipsis's Avatar
...
0 -1

Also, I'm not sure if you have already figured out how to search with a textbox or not, but in case you haven't here is how I do it.

Instead of having the "Search" button, you can just have a KeyDown event and if the e.KeyCode.Equals(Keys.Enter), replace every whitespace character with a plus sign, and use that string to create the Google query. browser.Navigate("https://www.google.com/search?q=" + newString);

That way you don't need a search button. The same can be done for the URL textbox. I personally think you should change the textbox to a combobox just for the fuck of it. I like easy access to sites I've been to before. You should also have a menuStrip so you can edit history and all of that stuff. A couple more forms for editing settings and accessing history and this is pretty much a stellar desktop application.

Did I mention that I can't wait to see your code in action? NERD OUT


ellipsis's Avatar
...
0 -1

ALSO

To make it more like Chrome (you said you wanted something like chrome), just do the Search thing inside the URL box. If the query doesn't end with ".com"/".org"/".net"/".edu"/.etc, assume it's a google query and just search google with that string, Clear() the textbox after searching so the user doesn't have to do that himself. And if the string begins with "http://" or "https://", assume it's a URL.

NERD OUT


ellipsis's Avatar
...
0 -1

FINAL

For bookmarks, keep a flatfile of every URL bookmarked. Show an input dialog (write it yourself) that allows you to name the bookmark. Store to flatfile in this format: <url>:<bookmark name>

The flatfile data can look like this:

https://pr0n.xxx:SRSLY DONT LOOK MOM! It's just pr0nz. https://hellboundhackers.org:I love HBH https://4chan.org/b/:/b/tards unite!

And read each line in the flatfile, split each line into two strings: urlStr and bookMarkStr.

After parsing the lines, create menuStripItems using the values and create Clicked events so you can access the websites.

When removing the bookmarks, remove the line from the flatfile and remove the menuStripItem to corresponding deleted bookmark. Should be obvious.

I'm just giving you TONS of exercises for your fun little browser project! I'll write my own browser too! We can compare our c0d3z dewd. How about that?!

I'm wayyyyyyy too stoked. If you couldn't tell. Love you, HBH. Goodnight.


ellipsis's Avatar
...
0 -1

buddywithgol wrote: when the user resize the form some of my Control are not visible.

I just wrote the application I described in the previous comments. I was inspired by your post.

I solved this issue by using WPF instead of Winforms.

It's 2012, WPF is gonna TAKE OVER!!!!!!!!!!!!!!!!! In my dreams.

It's good to know both Winforms and WPF, but I am in love with WPF.

If you're kick ass with Winforms, you'll LOVEEE WPF. So many cool features! Give it a shot if you haven't already!

Instead of creating a Windows Forms project, choose the WPF, and play around. It gives you Toolbox to drag&drop, everything is more intuitive, and if you're familiar with XAML, it'll make your WPF experience even better. I've finished the web browser, and now I'm off to bed. Finally.

Later, HBH.

P.S. I'd really like to see your solution to the hidden controls during resize thing. PM or pastebin. Just so I can do that as well in the future.


buddywithgol's Avatar
Member
0 0

thx for the replies appreciate it, but i have another problem every time i want to download something. it bring up internet explorer, i want to have my own download manager to handle the download any help is appreciated.


ellipsis's Avatar
...
0 -1

buddywithgol wrote: thx for the replies appreciate it, but i have another problem every time i want to download something. it bring up internet explorer, i want to have my own download manager to handle the download any help is appreciated.

Your problem is due in part to the WebBrowser class being just a wrapper for Internet Explorer. If you MessageBox.Show(browser.Version), you'll see that it displays the current version of your IE.

If you want to resolve this issue, you will need to implement your own HTML rendering software. There are probably many (or maybe not so many) APIs on the internet for doing this.

Good luck, man!