Click here to Skip to main content
Licence CPOL
First Posted 23 Aug 2006
Views 17,505
Downloads 748
Bookmarked 10 times

Decimal UpDown Control for Pocket PC

By | 23 Aug 2006 | Article
This control is used for decimal up-down operation in the Compact Framework.
Sample Image - DecimalUpDownCF.jpg

Introduction

I recently had a requirement of having a decimal Up Down control for a Pocket PC application. I was surprised to find that even though there is a numeric up down like one found in Form application, it lacks the “DecimalPlaces” property. I tried to look on the web as a good developer but I couldn't find one for this requirement. Finally, I wrote one for this application treating this as a learning exercise.

Solution

Please note that this article is not about how to create a user control. It just updates you on how to use this control.

For this solution, I have created a composite user control which uses 1 textbox, 2 pictures and a timer. The textbox is used for displaying the value of decimal updown control. The picture controls are used for scrolling the value and timer is used to increase\decrease the value when user keeps the mouse pressed on the pictures. This control also exposes got_focus and lost_focus events using a new event ChangeFocusEvent. You could use this as a template to expose other events as per your requirement.

How to Use this Control

Create a new pocket PC project and right click on the tools in the left hand side of IDE. Select “Choose Items” and add this control by browsing to this control's RELEASE folder. You will now be able to see a DecimalUpDownCF control in the toolbar. Drag and drop it on your application Window form. At this stage, you could change the properties – Maximum, Minimum, Increment and Value in the same way as of a standard Numeric UpDown control. If you go to the events list of this control, you would find “ChangeFocusEvent”. This event exposes the Focused property which indicates if control has got the focus or lost the focus.

Please find the sample code to use this event and to make any changes as per your requirements. Happy programming!

History

  • 23rd August, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

S Sansanwal

Architect

Australia Australia

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120528.1 | Last Updated 23 Aug 2006
Article Copyright 2006 by S Sansanwal
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid