Privacy Policy
Best viewed with:

☕ Buy me a coffee
Mick Dohertys' .net Tips and Tricks - Controls
All components on this page are offered under the
MIT
Copyright (c) 2005 Mick Doherty : http://www.dotnetrix.co.uk

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

license terms.

MenuSkinner

Drop a MenuSkin component on your form and standard menu items are extended with icon and font properties.
The Menuskin component has several properties with which you can modify the menus appearance.

Download...


Clock

The Clock control has no built in timer events. It is merely a Visual control. If you want it to show the current time then add a timer and relevant code to the form.

Download...


TabControlEX

03 Feb 2005 - New Bevel Appearance added and Draw Methods exposed for Inheritance Overrides.

20 Feb 2005 - Keyboard and mouse navigation improved to ignore/skip-over disabled TabPages.
Enabled property exposed on TabPageEX and modifications made so as to comply with Microsoft FxCop rules.

17 May 2005 - Bug Fix: SelectedIndexChanged was being fired twice when tab changed by mouse.

25 May 2005 - Bug Fix: When used with some 3rd party control libraries the TabAppearanceEX Enumeration was 'misplaced' by the IDE. This was due to nesting and so the enum has been moved. Also fixed a few new FXCop violations and added a custom designer to TabpageEX as the control misbehaved in VS2005 when using the standard tabpage designer.

11 June 2005 - Added InsertTabPage method and implemented the TabPageEX Hide() and Show() methods.

27 June 2005 - Added Visual Styles Support.

29 July 2005 - Added GroupBoxEX to the dll. Leave GroupBoxEX at FlatStyle.Standard as I have overridden the OnPaintBackGround() and OnPaint() methods to draw the control with Visual Style as necessary. Set the GroupBoxEX's BackColor property to Transparent and you should see the Themed Tabpage background (when it's on a themed tabpage). The only problem with this being that all controls added to the GroupBoxEX will inherit the Transparent Background color.

11 August 2005 - Bug Fix: Arrow Key navigated tabs even when Tabcontrol not focused, eg; when textbox as child of tabpage was selected.

24 March 2006 - Bug Fix: MouseDown and Click events were not being fired.

06 Dec 2006 - Bug Fix: Null Reference exception was raised randomly when changing TabPage Selection. Thanks to Sam J Martinez for his help in locating and fixing this bug.

22 March 2007 - Bug Fix: ArgumentException raised occasionally.

20 July 2007 - Bug Fix: Undo/Redo now works on the Design Surface.

21 October 2008 - Bug Fix: SelectedTabFontStyle defaulted to Regular rather than Controls Font.Style.

This control is a more complete version of the one shown in my Tips page. Unlike the TabControl from which it Inherits, you can set any Alignment value with any Appearance value.
An OnSelectedIndexChanging Method has been added to the TabControl so that you may cancel selection of a TabPage.
Disabled Tabs do not recieve a Click event.
Set AllowDrop and AllowTabDrag to True and you are able to drag TabItems around at runtime.
Mnemonic support has been added.
You may have to play around with Padding if you use non standard Font.

Download...


TabControl 2

As you may know TabControlEx is a Framework 1.1 Control (as are the other controls here). I have written a much simpler Framework 2.0 TabControl, which you can download below.
This does not have all the features of TabControlEx, but if all you want is Visual Styles support and disabled Tabs, then this version is much better.
It now uses GDI to draw the Tab text and so I have been able to correct the oversized Tab issue. DrawMode has been included, but unfortunately, due to the use of GDI, I have been unabled to find a way to get ownerdraw working with horizontal alignments. I am working on other projects at the moment so it is unlikely that I will find a fix for this in the near future.
If you're using any of the button Appearances, then you'll find that Keyboard Navigation has also been improved.

Download...


Tabpage Sorter

Most of us have encountered the TabPage reorder bug at some time, but are unable to recreate it with a specific set of steps and so MS will not look at it as a Bug. Not reproducible is their standard response. There are several workarounds for this, but since I still see the question being asked quite frequently, I decided to create a component which you can simply pop on the form and have it do all the sorting for you.
When you drop a TabPageSorter onto a form it will extend all tabpages with a SortIndex property. This will default to the zOrder (ChildIndex) of the tabpage. In case the SortIndex is not unique, a secondary sort will be done based upon the TabPages Name property. The component has a SortType property which will allow you to choose between a Dictionary Sort (11 comes before 2) or an AlphaNumeric sort (2 comes before 11).

At runtime you simply need to call one of the components two Sort method to arrange the tabs. Designtime sorting has been added, but this only sorts temporarily, upon a rebuild the IDE will rearrange the tabs.

The component has an overload that allows you to sort in ascending or descending order, but if you want to change the sort order by some other criteria then this can easily be done. The following code example simply reverses the sortorder without using the overloaded Sort method (assumes default SortIndex values).

    For Each tab As TabPage In Me.TabControl1.TabPages
        Me.TabPageSorter1.SetSortIndex(tab, Me.TabControl1.TabCount - _
                Me.TabPageSorter1.GetSortIndex(tab))
    Next
    Me.TabPageSorter1.Sort(Me.TabControl1)


    foreach (TabPage tab in this.tabControl1.TabPages)
    {
        this.tabPageSorter1.SetSortIndex(tab, this.tabControl1.TabCount - 
                this.tabPageSorter1.GetSortIndex(tab));
    }
    this.tabPageSorter1.Sort(this.tabControl1);

Download...


Trackbar

This modification of Trackbar allows you to select a transparent background. I have also added custom draw events so that you may easily modify the Appearance of the Control. Just select the parts which you want draw in the OwnerDrawParts property and then use the relevant Draw Event to draw them.

Download...

There is now a code example for a custom built TrackBar on my custom controls tips page. It needs some work to make it look pretty, but it's a much better option if you want a custom appearance.


UpDown Controls

This dll contains NumericUpDown and DomainUpDown Controls with added Visual Styles support.

Download...