PSIG_PTR
PSIG_PTR

Reputation:

DateTimePicker-like Input Control

I'm not very experienced with .NET development, so forgive me if I've missed something obvious.

My scenario is quite simple: my program is going to deal with both the Imperial and Metric systems of measurement. I need an input control that will be able to elegantly house {feet, inches} and {meters, centimeters} (only one set at a time).

From what I've seen in VC#'s Control Toolbox (Winforms .NETF 3.5), I'm looking for a mix of MaskedTextBox, NumericUpDown, and DateTimePicker.

Namely:

I should also point out that I'm most interested in replicating DateTimePicker's ability to keep separate pieces of input in a single control.

I would greatly appreciate your thoughts as to what base control I should sub-class in order to achieve this functionality.

Cheers!

Upvotes: 2

Views: 1154

Answers (2)

Mitch Wheat
Mitch Wheat

Reputation: 300559

Have you looked at this code project article which might be a starting point.

Upvotes: 1

boj
boj

Reputation: 11395

I think DateTimePicker isnt enough flexible to make that.

You should create a composite user control. The main control should contain:

  • Three NumericUpDown control (year, month, day)
  • Delegate events to every Validate event (instead of masked textbox)
  • Show a Calendar control when ie. user click into the NumbericUpDown control (or you can dedicate an '...' labelled button on the right)

Or yoou can search on CodeProject or Codeplex for opensource, and Telerik and DevX for shareware components.

Upvotes: 0

Related Questions