C# winforms Toolstrip Dropdown with toolstripcontr

2019-07-15 08:01发布

问题:

I have the bindingnavigator control with 5 items including a toolstripdownbutton. I programmatically add a toolstripcontrolhost that contains a panel to the toolstripdownbutton. When I open the dropdown first time, it shows in the location (0,0).During second and third times of dropdown opening the correct position. How do I fix this error?

FormTest formTest = new FormTest(); 
formTest.TopLevel = false; 
tsddbFormControl.DropDownItems.Clear(); 
formTest.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 
ToolStripControlHost host = new ToolStripControlHost(formTest);     
tsddbFormControl.DropDownItems.Add(host); 
formTest.Show();