I want to have my form in a wizard style and so I used TabControl to have the pages of the Wizard as my TabPages. There were small issues to be corrected, such as, making the tabs being displayed in runtime. I inherited the TabControl and I added a property called "TabsVisible" and corrected it. It worked fine. (See : http://dotnetrix.co.uk/tabcontrol.htm - Add a HideTabs property to turn on/off the Tabitems)
But there are other small issues like : 1. When Ctrl + Tab is pressed the tabs get changed. This is disabled by overriding the OnKeyDown method 2. When the active cursor is in the tab list, and if Arrow keys are pressed, the current tab page gets changed. How can I disable this??
So my question is - How can disable Arrow keys in tabControl so that the tab page doesn't get changed?
In other words: you don't need the tab control. Why don't you just use Panels to contain your GUI for the different Wizard steps, and buttons or something else as the Wizard steps themselves, and save yourself all that trouble? That way you'll be free of all this, AND will be able to style it however you see fit - much simpler and much more flexible.
To disable the arrow key from changing the page of your TabControl, you can handle the KeyDown event, and do something like this:
So basically you mark the event as handled if the pressed key is an arrow key.
I created a WizardControl framework. It uses a wizardFormBase. You load the form with a UserControl collection. The rest happens auto-magically. This was based on the following series ...
http://weblogs.asp.net/justin_rogers/articles/60155.aspx
Article 1 is pretty stupid...but he fixes it by article 2.
I did not do it exactly like this. Here are my bits for this. You will have to remove the telerik controls references and replace with actual winforms control references.
You setup the UIRoot which is basically the panel control (or any other container control) to load the pages into. The Pages are USerControls but you could change that to host any type of control.
WizardFormBase
WizardFormBase designer file
Hope this helps.
Seth
I did it the following. Had a flag if the selected tab was being changed from the code. If so I allowed it or else it is disallowed. The following code worked fine for me.