-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
86 lines (74 loc) · 3.31 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace UserControlTesterProject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//advancedNumericBox1.NumberFormatSpecifier = "E3";
advancedNumericBox1.EnterKeyUpCustom += AdvancedNumericBox1_EnterKeyUpCustom;
advancedNumericBox1.FocusLostCustom += AdvancedNumericBox1_FocusLostCustom;
advancedNumericBox1.InvalidInput += AdvancedNumericBox1_InvalidInputOccured;
advancedNumericBox1.OutOfRange += AdvancedNumericBox1_OutOfRange;
advancedNumericBox1.SetMinimum(-100);
advancedNumericBox1.SetMaximum(500);
advancedNumericBox1.EnableToolTip($"Min: -100\r\nMax: 500\r\nOut of range will be coerced.");
advancedNumericBox1.SetValue(100);
advancedNumericBox1.CoerceOutOfRange = true;
advancedSlider1.EnterKeyUpCustom += AdvancedNumericBox1_EnterKeyUpCustom;
advancedSlider1.FocusLostCustom += AdvancedNumericBox1_FocusLostCustom;
advancedSlider1.InvalidInput += AdvancedNumericBox1_InvalidInputOccured;
advancedSlider1.OutOfRange += AdvancedNumericBox1_OutOfRange;
advancedSlider1.ValueChangedFinal += AdvancedSlider1_ValueChangedFinal;
advancedSlider1.ValueChanged += AdvancedSlider1_ValueChanged;
advancedSlider1.Label = "parameter:";
advancedSlider1.SetMinimum(-0.1);
advancedSlider1.SetMaximum(1.5);
advancedSlider1.EnableToolTip($"Min: -0.1\r\nMax: 1.5\r\nOut of range will be coerced.");
advancedSlider1.SetValue(0.5);
advancedSlider1.CoerceOutOfRange = true;
}
private void AdvancedSlider1_ValueChanged(object sender, EventArgs e)
{
textBox3.Text = $"{advancedSlider1.GetValue()}";
}
private void AdvancedSlider1_ValueChangedFinal(object sender, EventArgs e)
{
textBox2.Text = $"{advancedSlider1.GetValue()}";
}
private void AdvancedNumericBox1_OutOfRange(object sender, EventArgs e)
{
MessageBox.Show("Invalid input, out of range!");
}
private void AdvancedNumericBox1_InvalidInputOccured(object sender, EventArgs e)
{
MessageBox.Show("Invalid input, not a number! Reverted to original value!");
}
private void AdvancedNumericBox1_FocusLostCustom(object sender, EventArgs e)
{
textBox1.Text = $"{advancedNumericBox1.GetValue()}";
//textBox2.Text = $"{advancedSlider1.GetValue()}";
}
private void AdvancedNumericBox1_EnterKeyUpCustom(object sender, EventArgs e)
{
textBox1.Text = $"{advancedNumericBox1.GetValue()}";
//textBox2.Text = $"{advancedSlider1.GetValue()}";
}
private void button1_Click(object sender, EventArgs e)
{
advancedNumericBox1.SetValue(0.000034567);
//advancedSlider1.SetSliderResolution(10000);
}
}
}