none
Code for positioning of a Web Browser tool. RRS feed

  • Question

  • Hello everyone, i am still learning code inside of visual studio but i want to make a browser.

    I have the basic stuff done like a back and forward buttons with a search bar and search button. I have these coded to work nicely but when i run the program and put it into full screen the positioning of the web Browser window is not fitting the size of the form window.

    I want the top of the browser window to be about 100 down so there is room for the buttons and search bar. The language i am using is c# and need help with this.

    Any other questions, i will try answer them as best I can.

    Thanks in advanced, SD2020.

    Saturday, May 28, 2016 9:17 PM

All replies

  •  I believe you would want to set the Anchor property of the WebBrowser control.

    If you place the WebBrowser control on the Form and it is sized by you such that the top is 100 down or so and the bottom is at the bottom of the Form and the sides are to each side of the Form then check the properties of the WebBrowser control and set the Anchor to Left, Top, Bottom and Right rather than just Left and Top which is default.

    Then when you maximize the Form the control will expand to fit.

    Setting anchors for a control can be performed programmatically also. The below code is converted from VB to C# so I'm not certain it will work for you. It is used with a DataGridView. Alter it for your WebBrowser I suppose.

    DataGridView1.Anchor == (AnchorStyles)AnchorStyles.Bottom + AnchorStyles.Left + AnchorStyles.Right + AnchorStyles.Top
    Update: Since you program in C# perhaps you should post your questions in the Visual C# forum in the future.


    La vida loca

    Saturday, May 28, 2016 9:33 PM
  • Your a legend mate thanks for the tips :)

    I tried pasting the code, but it didnt work so i done the Anchor points :) 

    And I will also post in the C# area next time, still new to this forums :)

    Saturday, May 28, 2016 10:18 PM
  • Your a legend mate thanks for the tips :)

    I tried pasting the code, but it didnt work so i done the Anchor points :) 

    And I will also post in the C# area next time, still new to this forums :)


    You're welcome. Sorry bout the code. I'm certain someone in the C# forum could provide the correct code and where/how to use it.

    La vida loca

    Saturday, May 28, 2016 11:23 PM
  • Its no worries for now and I will have a look around :)
    Monday, May 30, 2016 9:28 AM