C# winforms Toolstrip Dropdown with toolstripcontrolhost opens at (0,0) location at first time

家住魔仙堡 提交于 2019-12-24 01:26:03

问题


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();

来源:https://stackoverflow.com/questions/20044855/c-sharp-winforms-toolstrip-dropdown-with-toolstripcontrolhost-opens-at-0-0-loc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!