/[RomCheater]/trunk/Win32/libWin32/Win32/UI/MultiNumericBox.cs
ViewVC logotype

Contents of /trunk/Win32/libWin32/Win32/UI/MultiNumericBox.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 223 - (show annotations) (download)
Sat Jun 2 13:20:13 2012 UTC (8 years, 5 months ago) by william
File size: 2951 byte(s)
+ add support for multi input box : octal is not setup

1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9
10 namespace System.Windows.Forms
11 {
12 public partial class MultiNumericBox : NumericBoxBase
13 {
14 public MultiNumericBox()
15 : base()
16 {
17 InitializeComponent();
18 this.Value = 0;
19 this.ReadOnly = false;
20 InputType = MultiNumericBox_InputType.Default;
21 }
22
23 new public ValueType Value
24 {
25 get { return this.ToSingle(); }
26 set { base.Value = value; }
27 }
28 public override string Text
29 {
30 get { return base.Text; }
31 set { base.Text = value; }
32 }
33
34 private MultiNumericBox_InputType _InputType;
35 public MultiNumericBox_InputType InputType
36 {
37 get { return _InputType; }
38 set
39 {
40 _InputType = value;
41 }
42 }
43
44 protected override void CreateValidKeys(List<Keys> ValidKeys)
45 {
46 base.CreateStandardKeys(ValidKeys);
47 switch (InputType)
48 {
49 case MultiNumericBox_InputType.Binary:
50 ValidKeys.Add(Keys.D0);
51 ValidKeys.Add(Keys.NumPad0);
52 ValidKeys.Add(Keys.D1);
53 ValidKeys.Add(Keys.NumPad1);
54 break;
55 case MultiNumericBox_InputType.Octal:
56 break;
57 case MultiNumericBox_InputType.Hex:
58 case MultiNumericBox_InputType.IEEE754HexFloat:
59 ValidKeys.AddRange(Enum.GetValues(typeof(Keys)).Cast<Keys>().Where(x => x >= Keys.D0 && x <= Keys.D9));
60 ValidKeys.AddRange(Enum.GetValues(typeof(Keys)).Cast<Keys>().Where(x => x >= Keys.NumPad0 && x <= Keys.NumPad9));
61 ValidKeys.Add(Keys.A);
62 ValidKeys.Add(Keys.B);
63 ValidKeys.Add(Keys.C);
64 ValidKeys.Add(Keys.D);
65 ValidKeys.Add(Keys.E);
66 ValidKeys.Add(Keys.F);
67 break;
68 case MultiNumericBox_InputType.Decimal:
69 ValidKeys.Add(Keys.Decimal);
70 ValidKeys.Add(Keys.OemPeriod);
71 ValidKeys.AddRange(Enum.GetValues(typeof(Keys)).Cast<Keys>().Where(x => x >= Keys.D0 && x <= Keys.D9));
72 ValidKeys.AddRange(Enum.GetValues(typeof(Keys)).Cast<Keys>().Where(x => x >= Keys.NumPad0 && x <= Keys.NumPad9));
73 break;
74 }
75 }
76 }
77
78 public enum MultiNumericBox_InputType
79 {
80 Decimal,
81 Binary,
82 Octal,
83 Hex,
84 IEEE754HexFloat,
85 Default = Decimal,
86 }
87 }

  ViewVC Help
Powered by ViewVC 1.1.22