MWControls v1.0.3.0

This latest version includes a Multi SelectTreeView Control which lets you choose between a few different ways ofselecting TreeNodes.

There is a test project set up (MWControlsTest) for testing all of the MWControls.

MWControls contains:
MWTreeView: A Multi Select TreeView Control (MultiSelect, Multi-Select)
MWScrollLabel: A Label Control that scrolls the Text back and forth if it does not fit when the mouse is hovering over it.
The MWScrollLabel Control also supports displaying the Text in different directions: Normal, UpsideDown, Left and Right.
MWLabel: A Label Control that uses StringFormat.GenericTypographic,meaning that the Text doesn't require a large blank area next to it.
The MWLabel Control also supports displaying the Text in different directions: Normal, UpsideDown, Left and Right.

Coding technologies used:
=========================
MWTreeView:
Multi Select for TreeNodes.
Overridden CancelEventArgs so that AfterXXX and BeforeXXX EventHandlerscan be set up allowing the programmer to cancel setting properties.
MWScrollLabel:
A timer is used for the scrolling.
MWLabel and MWScrollLabel:
GDI+ is used to draw everything (Text and Image).
The Text is rendered properly as disabled when the Enabled property is set to false.
A graphical Design Time Editor imheriting from UITypeEditor is used for the TextDir property.
All:
Inheritance including overriding EventHandlers and programming aroundthe fact that some methods etc in the parent Control are hidden.

Shortcomings:
=============
MWLabeland MWScrollLabel: The UseMnemonic property is not used. (I don'tintend to fix this myself. If someone has a solution, please let meknow.)
MWTreeView: When HotTracking is turned on the colors are not correct.(I will probably not fix this myself. If someone has a solution, pleaselet me know.)

Version history and more about the Controls:
============================================

version 1.0.3.0
—————
MWTreeView

The MWTreeView Control supports proper MultiSelect functionality. When I say proper I mean better than any otherfree one I have seen out there (C# or other).

MultiSelect is a property of the MWTreeView Control and can be set to one of the following values:
NoMulti: Multi Selection is turned off. All other features are stillavailable though, so it still works better than a normal TreeViewControl.
Multi: Free unrestricted Multi Selection – any TreeNodes can be selected.
MultiSameBranchAndLevel: Multiple TreeNodes can only be selected if they are in the same branch and on the same level.
MultiSameBranch: Multiple TreeNodes can only be selected if they are in the same branch.
MultiSameLevel: Multiple TreeNodes can only be selected if they are on the same level.

Several keys now do things to the MWTreeView:ctrl-A selects all TreeNodes (according to the restrictions imposed bythe MultiSelect property), etc, etc.

TreeNodes can be selected using the mouse in combination with the control, shift and alt keys.

If the MultiSelect property is set to a valueother than NoMulti, no TreeNode has to be selected at all. and once oneis selected it can be deselected (control and mouse click).

The FullRowSelect property of the originalTreeView Control didn't seem to work (please correct me if I'm wrong).It has now been implemented.

There is a massive amount of code (more than3400 lines in the MWTreeView class alone), so I guess this is anexample (hopefully a good one) of how to subclass a Control and add alot of functionality.

version 1.0.2.0
—————
MWControlsTest

The MWControlsTest project has been added, making it really easy to test all the features of the MWControls.
Any new Controls added to MWControls can appear on a new TabPage.

version 1.0.1.0
—————
MWScrollLabel

The MWScrollLabel is a subclassed LabelControl that can be set to scroll the Text back and forth if the wholeText does not fit. The way I am using this is by starting the scrollingwhen the mouse is hovering over the Control.There are quite a few options that can be set to control the scrolling.

Note that the MWScollLabel Control is onlydisplaying its Text on one line. This is intentional and coupled withits scrolling capabilities is really the whole reason for implementingthis Control.

version 1.0.0.0
—————
MWLabel

The StringFormat used by the Text can be set to one of two options: GenericDefault and GenericTypographic.
GenericDefault: This is the StringFormat used by the original Label Control.
GenericTypographic: This StringFormat is much more precise when it comes to measuring the string.
Usingthe GenericTypographic option (default) means that if the Text isright-aligned it will indeed properly align to the right even for verylong words with no white-space.

The Text Direction can be set:
Normal: Normal horizontal Text.
UpsideDown: Horizontal Text displayed upside down.
Left: Vertical Text that can be read by tilting your head to the left.
Right: Vertical Text that can be read by tilting your head to the right.

There is an option of displaying an Image (thenormal Image property or the Image from the ImageIndex property) overthe Text or like the normal Label Control under the Text.

The Image (the normal Image property or theImage from the ImageIndex property), if one is used, is displayed veryclose to the applicable edge – not some strange arbitrary distance fromthe edge.

Disclaimer:
===========
Mikael Wiberg 2003
mikwib@hotmail.com (usual HoTMaiL spam filters)
mick@ar.com.au (heavy spam filters on, harldy anything gets through,start the subject with C# and it will probably go through)
md5mw@mdstud.chalmers.se (heavy spam filters on, harldyanything gets through, start the subject with C# and it will probablygo through)

Feel free to use this code as you wish, as long as you do not take credit for it yourself.
If it is used in commercial projects or applications please mention my name.
Feel free to donate any amount of money if this code makes you happy ;)
Use this code at your own risk. If your machine blows up while using it – don't blame me.

MWControls01 MWControls v1.0.3.0

MWControls02 MWControls v1.0.3.0

Most Commented Articles :

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!