We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Can Clock control be used as a Countdown Clock


Can the Windows Forms Clock control be used as a countdown clock?

3 Replies

KR Kannan R Syncfusion Team February 22, 2017 06:18 AM UTC

Hi Stan,   
   
Thank you for contacting Syncfusion Support.    
   
Yes, Syncfusion Clock control can be used as Count Clock, and this can be achieved by using its properties named “StopTimer”, “CustomTime”, and “ShowCustomTimeClock”. Please make use of the below code snippet to achieve your requirement.   
   
Code Snippet: [C#]   
   
   
//To show the custom time   
this.clock1.ShowCustomTimeClock = true;   
// To hide Dates in Digital Clock   
this.clock1.DisplayDates = false;   
//To set the Custom time / Reset the clock   
this.clock1.CustomTime = new DateTime();   
// To Freeze and Un Freeze the Clock   
this.clock1.StopTimer = true;   
   
 
Screenshot   
   
   
   
We have also prepared a sample for your reference, and it can be downloaded from:   
 
   
Kindly check the above solution and let us know if it was helpful.   
   
Regards   
Kannan   
 



SL Stan Laffrey February 22, 2017 03:19 PM UTC

Thanks Kannan!  Is there a way to make the clock count down instead of up?  (e.g., 10....9.....8.....)


KR Kannan R Syncfusion Team February 27, 2017 01:00 PM UTC

Hi Stan,    
    
Thank you for contacting Syncfusion Support.     
    
Yes, this reported requirement can be achieved by using its properties named “StopTimer”, “CustomTime”, and using Timer. Please make use of the below code snippet to achieve your requirement.    
    
Code Snippet: [C#]    
    
 
         void CountDownTimer_Tick(object sender, EventArgs e) 
        { 
            if ((this.clock1.CustomTime.Second - 1) > 0) 
            { 
                this.clock1.CustomTime = this.clock1.CustomTime.AddSeconds(-1); 
                this.clock2.CustomTime = this.clock1.CustomTime.AddSeconds(-1); 
            } 
            else 
            { 
                this.clock1.CustomTime = new DateTime(); 
                this.clock2.CustomTime = new DateTime(); 
                this.CountDownTimer.Stop(); 
                this.buttonAdv1.Text = "Reset the Clock"; 
            } 
        } 
 
  
Screenshot    
    
    
    
We have also prepared a sample for your reference, and it can be downloaded from:    
  
    
Kindly check the above solution and let us know if it was helpful.    
    
Regards    
Kannan    
  
 


Loader.
Live Chat Icon For mobile
Up arrow icon