Help Please!: Webbrowser control and changing sizeIs there a way to make, If a toolbar is not visible make webbrowser co
15 Replies - 9801 Views - Last Post: 14 September 2009 - 01:23 AM
#1
Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 02:47 PM
Thanks a lot in advance,
Replies To: Help Please!: Webbrowser control and changing size
#2
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 03:10 PM
#3
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 03:37 PM
If Me.ToolStrip.Visible Then ' Tool Strip is visible so attach to bottom of toolstrip me.WebbrowserControl.Top=Me.ToolStripBottom Else ' Tool Strip is not visible so attach top to top of form Me.WebBrowserControl.Top=Me.Top endif
#4
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 03:41 PM
AdamSpeight2008, on 20 Aug, 2008 - 03:10 PM, said:
Sure! at the top you can see that the toolbars is not visible but the web browser does not expand to fill the empty space and so all you see is the background color of the form.. what I want to do is make it so that the webbrowser expands to asnchor to the tabcontrol when the toolbars are not visible and anchors to the of the bottom toolbar when the toolbars are visible.
Attached image(s)
#5
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 04:04 PM
yapper99, on 20 Aug, 2008 - 11:41 PM, said:
AdamSpeight2008, on 20 Aug, 2008 - 03:10 PM, said:
Sure! at the top you can see that the toolbars is not visible but the web browser does not expand to fill the empty space and so all you see is the background color of the form.. what I want to do is make it so that the webbrowser expands to asnchor to the tabcontrol when the toolbars are not visible and anchors to the of the bottom toolbar when the toolbars are visible.
Try using
If Me.ToolStrip.Visible Then ' Tool Strip is visible so attach to bottom of toolstrip me.WebbrowserControl.Top=Me.ToolStrip.Bottom Me.WebbrowserControl.Height-=Me.ToolStrip.Height Else ' Tool Strip is not visible so attach top to top of form Me.WebBrowserControl.Top=Me.TabStrip.Bottom Me.WebbrowserControl.Height+=Me.ToolStrip.Height Endif
This post has been edited by AdamSpeight2008: 20 August 2008 - 04:10 PM
#6
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 04:17 PM
thanks
#7
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 04:46 PM
yapper99, on 21 Aug, 2008 - 12:17 AM, said:
thanks
Remove the anchors and dock (set them to none)
Put the code in the ToolStrip1.VisibleChanged event
#8
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 05:16 PM
Remove the anchors and dock (set them to none)
Put the code in the ToolStrip1.VisibleChanged event
[/quote]
i don't seem to sound noobish but how do that is it a Private sub...
#9
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 05:29 PM
yapper99, on 21 Aug, 2008 - 01:16 AM, said:
Remove the anchors and dock (set them to none)
Put the code in the ToolStrip1.VisibleChanged event
[/quote]
i don't seem to sound noobish but how do that is it a Private sub...
[/quote]
The private means it can be access from within the form.
Score of Variable Tutorial
Private Sub ToolStrip1_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStrip1.VisibleChanged
If Me.ToolStrip1.Visible Then
' Tool Strip is visible so attach to bottom of toolstrip
Me.WebBrowser2.Top = Me.ToolStrip1.Bottom
Me.WebBrowser2.Height -= Me.ToolStrip1.Height
Else
' Tool Strip is not visible so attach top to top of form
Me.WebBrowser2.Top = Me.TabPage1.Bottom
Me.WebBrowser2.Height += Me.ToolStrip1.Height
End If
End Sub
#10
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 06:06 PM
Private Sub ToolStrip1_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStrip1.VisibleChanged
If Me.ToolStrip1.Visible Then
' Tool Strip is visible so attach to bottom of toolstrip
Me.WebBrowser2.Top = Me.ToolStrip1.Bottom
Me.WebBrowser2.Height -= Me.ToolStrip1.Height
Else
' Tool Strip is not visible so attach top to top of form
Me.WebBrowser2.Top = Me.TabPage1.Bottom
Me.WebBrowser2.Height += Me.ToolStrip1.Height
End If
End Sub
[/quote]
the height changing code works great but the thing is it changes the height from both the bottom and the top....so when the program default starts the webbrowser is not the proper height...also the Me.WebBrowser2.Top = Me.TabPage1.Bottom and Me.WebBrowser2.Top = Me.ToolStrip1.Bottom do not seem to work??
sorry i forget to add this......here is my slightly altered code
If Me.ToolStrip4.Visible = False Then Me.WebBrowser2.Top = Me.TabPage1.Top Me.WebBrowser2.Height += Me.ToolStrip4.Height And Me.ToolStrip6.Height Else If ToolStrip4.Visible = True Then Me.WebBrowser2.Height -= Me.ToolStrip4.Height And Me.ToolStrip6.Height Me.WebBrowser2.Top = Me.ToolStrip4.Bottom End If End If
#11
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 06:14 PM
yapper99, on 21 Aug, 2008 - 02:06 AM, said:
If Me.ToolStrip4.Visible = False Then Me.WebBrowser2.Top = Me.TabPage1.bottom Me.WebBrowser2.Height += Me.ToolStrip4.Height Else If ToolStrip4.Visible = True Then Me.WebBrowser2.Height -= Me.ToolStrip4.Height Me.WebBrowser2.Top = Me.ToolStrip4.Bottom End If End If
Change the names to the name of the control you are using.
This post has been edited by AdamSpeight2008: 20 August 2008 - 06:16 PM
#12
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 06:17 PM
Change the names to the name of the control you are using.
[/quote]
I changed the names to fit my project i.e. toolstrip 6...... is that what you mean?
#13
Re: Help Please!: Webbrowser control and changing size
Posted 20 August 2008 - 06:32 PM
#14
Re: Help Please!: Webbrowser control and changing size
Posted 24 August 2008 - 01:22 PM
AdamSpeight2008, on 20 Aug, 2008 - 06:32 PM, said:
I changed the names to fit my project i.e. toolstrip 6...... is that what you mean?
[/quote]
yes
[/quote]
I did everything but the code just won't work properly
Private Sub ToolStrip9_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStrip9.VisibleChanged If Me.ToolStrip9.Visible Then Me.WebBrowser3.Top = Me.ToolStrip9.Bottom Me.WebBrowser3.Height -= Me.ToolStrip9.Height And Me.ToolStrip8.Height Else Me.WebBrowser3.Top = Me.TabPage2.Top Me.WebBrowser3.Height += Me.ToolStrip9.Height And Me.ToolStrip8.Height End If End Sub
firstly when the application is started up the web browser is not the proper size because the height is reduced
Me.WebBrowser3.Height -= Me.ToolStrip9.Height And Me.ToolStrip8.Height
secondly for some reason even though it states
Me.WebBrowser3.Top = Me.ToolStrip9.Bottomthe top of the webbrowser goes to the top of the toolstrip and therefore covers the toolstrip?
also i have toolstrips 8 and 9.....
thanks,
#15
Re: Help Please!: Webbrowser control and changing size
Posted 24 August 2008 - 01:42 PM
Me.ToolStrip9.Height And Me.ToolStrip8.Height
Private Sub ToolStrip9_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStrip9.VisibleChanged If Me.ToolStrip9.Visible Then Me.WebBrowser3.Top = Me.ToolStrip9.Bottom Me.WebBrowser3.Height -= Me.ToolStrip9.Height Else Me.WebBrowser3.Top = Me.TabPage2.Bottom Me.WebBrowser3.Height += Me.ToolStrip9.Height End If End Sub
In then FormLoad Event
Me.ToolStrip9.visible=true
|
|

New Topic/Question
Reply




MultiQuote




|