RikWare
...

TimeSpanPicker released under BSD

Wednesday, 30 April 2008 22:49 by Richard Mason

A request via email has encouraged me to release the TimeSpanPicker control I blogged about a few years ago. The details are available at http://www.rikware.com/page/TimeSpanPicker.aspx but I've copied them in here for ease of reading: 

The TimeSpanPicker is a Windows Forms UpDown control for editing TimeSpan values. It is currently used in RikPVR (http://www.rikpvr.com/)

The control is provided, as is, under a BSD license (meaning it's free to use and alter in free or commercial projects). Any improvements will be greatly appreciated.

A Visual Studio 2008 solution (including binaries) containing the project is available here: TimeSpanPicker.zip (121.65 kb)

The project targets .NET 2.0 and should be simple to recompile in Visual Studio 2005.

The control supports input via keyboard, mouse wheel or via the up/down buttons. It is also theme aware.

kick it on DotNetKicks.com

Comments

April 30. 2008 22:55

trackback

Trackback from DotNetKicks.com

TimeSpanPicker released under BSD

DotNetKicks.com

May 1. 2008 04:26

suhail

Nice work!

suhail

October 17. 2008 10:23

Boinst

Thankyou! Made a small modification to the 'Parse' method to avoid an unnecessary exception being thrown:

int index = Text.IndexOf(' ');
            string timeSpan = (index == -1) ? Text : Text.Substring(0, index);
            Regex timeSpanRegex = new Regex(@"^(?'hours'\d+)Frown?'minutes'\d+)Frown?'seconds'\d+)$");
            if (timeSpanRegex.IsMatch(timeSpan))
            {
                Match match = timeSpanRegex.Matches(timeSpan)[0];
                int hours = int.Parse(match.Groups["hours"].Value);
                int minutes = int.Parse(match.Groups["minutes"].Value);
                int seconds = int.Parse(match.Groups["seconds"].Value);
                userEdit = false;
                return new TimeSpan(hours, minutes, seconds);
            }
            else
            {
                userEdit = false;
                return Value;
            }


www.optimatics.com

Boinst

Comments are closed