المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Taborder in toolbar?



C# Programming
07-03-2009, 04:22 PM
Hello,

I'having problems getting the "Taborder" right on a ToolBar which has a UserControl hosted in a ToolStripControlhost object.

To replicate:
1. Create a new WindowsForms project.
2 Add a toolBar with four ToolBarButtons to Form1 (via the designer)
3. Create a new UserControl and drop a MaskedTextBox on it (via the designer)
5. In the form Constructor add the following code;
toolStrip1.Items.Insert(2, new ToolStripControlHost(new UserControl1()));

During runtime if you click on the maskedTextBox in the toolStrip (to give it focus), and try to navigate with the tab key (either shifttab or tab) you'll notice a weird taborder.

If the MaskedTextbox is hosted directly in the ToolStripHostControl everything works fine. But my real usercontrol is way too comlicated to do this.

The problem seems to be caused by inserting a usercontrol in a toolstrip which messes up the taborder.
Does anyone know how to fix this? Any help would be sincerely appreciated.