ToolStripDropDown renders at position 0,0 on first click
I'm trying to add a WebBrowser object into a ToolStripDropDownButton's drop-down. When I first click the button the drop-down shows at screen position 0,0. On subsequent clicks of the button the drop-down shows underneath the button like it should. Any idea on how to get the drop-down to show properly on the first click?
Dim browser As New WebBrowser
browser.Url = New Uri("http://localhost/test.html")
Dim host As New ToolStripControlHost(browser)
Dim dropDown As New ToolStripDropDown
ToolStripDropDownButton1.DropDown = dropDown
Thanks JohnH. However, that doesn't solve what I need. That just seems to open the drop-down right off the bat.
I probably should have been a little more explicit in my original post, but what I'm trying to do is to create a toolbar for IE. I want to have certain drop-down buttons be populated dynamically with html. I've tried opening and then closing the drop-down via code on instantiation and that works somewhat. The problem then is that the user has to click on the drop-down button twice for it to show the drop-down.
I tested in winforms, right. The first thought was to call CreateControl method, which is part of what Visible property setter also calls for controls that has not been created and assigned window handles yet, but that didn't have any effect in winforms.
The problem may be related to the drop-down not detecting any items, it is one of the cases where internal DropDownLocation returns Point.Empty. Again testing in winforms, if I add another empty element to the dropdown it shows at correct location first time: