сдано
This commit is contained in:
parent
17102989ae
commit
65deacff8e
@ -52,10 +52,23 @@ namespace VisualComponentsLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EventHandler onValueChanged;
|
||||||
|
public event EventHandler ValueChanged
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
onValueChanged += value;
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
onValueChanged -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void comboBox_SelectedValueChanged(object sender, EventArgs e)
|
private void comboBox_SelectedValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dropDownList.BackColor == Color.LightGreen) dropDownList.BackColor = Color.Tomato;
|
onValueChanged?.Invoke(sender, e);
|
||||||
else dropDownList.BackColor = Color.LightGreen;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ namespace VisualComponentsLib
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Неправильный адрес");
|
Error = "Некорректный ввод";
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@ -46,10 +47,14 @@ namespace VisualComponentsLib
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Неправильный адрес");
|
Error = "Некорректный ввод";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string Error
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
public void setExample(string str)
|
public void setExample(string str)
|
||||||
{
|
{
|
||||||
Regex rg = new Regex(Pattern);
|
Regex rg = new Regex(Pattern);
|
||||||
@ -63,23 +68,26 @@ namespace VisualComponentsLib
|
|||||||
private void textBox_Enter(object sender, EventArgs e)
|
private void textBox_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int VisibleTime = 2000; //ms
|
int VisibleTime = 2000; //ms
|
||||||
|
|
||||||
ToolTip tooltip = new ToolTip();
|
ToolTip tooltip = new ToolTip();
|
||||||
tooltip.Show(example, emailTextBox, 30, -20, VisibleTime);
|
tooltip.Show(example, emailTextBox, 30, -20, VisibleTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EventHandler onValueChanged;
|
||||||
|
public event EventHandler ValueChanged
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
onValueChanged += value;
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
onValueChanged -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void textBox_TextChanged(object sender, EventArgs e)
|
private void textBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Regex rg = new Regex(Pattern);
|
onValueChanged?.Invoke(sender, e);
|
||||||
bool address = rg.IsMatch(emailTextBox.Text);
|
|
||||||
if (address)
|
|
||||||
{
|
|
||||||
emailTextBox.BackColor = Color.Green;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
emailTextBox.BackColor = Color.Red;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
partial class Form1
|
partial class FormForComponents
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
@ -1,13 +1,12 @@
|
|||||||
using System.Security.Cryptography;
|
|
||||||
using VisualComponentsLib.Object;
|
using VisualComponentsLib.Object;
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class FormForComponents : Form
|
||||||
{
|
{
|
||||||
List<string> list = new List<string>();
|
List<string> list = new List<string>();
|
||||||
List<Student> students = new List<Student>();
|
List<Student> students = new List<Student>();
|
||||||
public Form1()
|
public FormForComponents()
|
||||||
{
|
{
|
||||||
list = new List<string>();
|
list = new List<string>();
|
||||||
list.AddRange(new string[] { "õëåá", "ìîëîêî", "êîëáàñà" });
|
list.AddRange(new string[] { "õëåá", "ìîëîêî", "êîëáàñà" });
|
||||||
@ -21,6 +20,11 @@ namespace WinForms
|
|||||||
dropDownList.LoadValues(new List<string>() { "ñîê", "ÿáëîêî", "ëóê" });
|
dropDownList.LoadValues(new List<string>() { "ñîê", "ÿáëîêî", "ëóê" });
|
||||||
emailTextBox.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
|
emailTextBox.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
|
||||||
listBoxObj.SetLayoutInfo("Ôàìèëèÿ *Name* Ãðóïïà *Group* Ôàêóëüòåò *Faculty* Êóðñ *Course*", "*", "*");
|
listBoxObj.SetLayoutInfo("Ôàìèëèÿ *Name* Ãðóïïà *Group* Ôàêóëüòåò *Faculty* Êóðñ *Course*", "*", "*");
|
||||||
|
dropDownList.ValueChanged += CustomEventHandler;
|
||||||
|
}
|
||||||
|
private void CustomEventHandler(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Âûáðàííûé ýëåìåíò èçìåíåí");
|
||||||
}
|
}
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
@ -11,7 +11,7 @@ namespace WinForms
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(new FormForComponents());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user