Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET - Are there any flip clock controls?

For a .NET (Winforms) application are there any flip clock controls?

Ideally it would look something like the one found on the BlackBerry Bold:

alt text http://images.crackberry.com/files/u3/reviewimages/blackberry9000c/lgclock3.jpg

UPDATE 1:

Following this SO link I have added an element host to my project to host the WPF retroclock that @Shane mentioned.

UPDATE 2:

A few steps that I followed:

  • Compile RetroClock
  • Add DLL reference to WinForm App
  • Add 'using WPFControls.Clocks;'
  • Add 'elementHost' to Form
  • In Form Load event add:

    //create retroclock

    RetroClock rc = new RetroClock();

    //add retroclock to element host

    elementHost1.Child = rc;

UPDATE 3:

Styling the clock

//style clock
rc.Height = 30;
rc.IncludeLeadingZero = true;
rc.IsAmPmVisible = true;
rc.FontSize = 60;
rc.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
rc.TimeFormat = TimeFormats.Hour12;
like image 710
John M Avatar asked May 19 '10 18:05

John M


3 Answers

Going along with Joel's answer, there's a simple one for WPF here.

like image 97
Shane Fulmer Avatar answered Oct 28 '22 23:10

Shane Fulmer


That would be a little out of place for winforms, the main point of which is to expose the common controls to .Net to help developers build windows applications that use the "standard" look and feel. This doesn't mean you won't find one, but that you should think 3rd party first here. Anything provided by Microsoft is going to be at best an afterthought.

WPF, on the other hand, is a much better fit for this kind of thing.

like image 38
Joel Coehoorn Avatar answered Oct 29 '22 01:10

Joel Coehoorn


It's pretty easy to make one yourself. Add a class, derive it from Control. You'll need a Timer that keeps it going, have its Tick method call Invalidate(). Override OnPaint() to draw the digits and am/pm indicator. You'll want the TextRenderer.DrawText() overload that draws inside a rectangle to get the digits centered. Draw a black line through the center.

Ought to be fun.

like image 39
Hans Passant Avatar answered Oct 28 '22 23:10

Hans Passant