сдано

This commit is contained in:
ityurner02@mail.ru 2023-09-16 11:05:11 +04:00
parent 17102989ae
commit 65deacff8e
6 changed files with 45 additions and 20 deletions

View File

@ -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)
{
if (dropDownList.BackColor == Color.LightGreen) dropDownList.BackColor = Color.Tomato;
else dropDownList.BackColor = Color.LightGreen;
onValueChanged?.Invoke(sender, e);
}
}
}

View File

@ -33,7 +33,8 @@ namespace VisualComponentsLib
}
else
{
throw new Exception("Неправильный адрес");
Error = "Некорректный ввод";
return null;
}
}
set
@ -46,10 +47,14 @@ namespace VisualComponentsLib
}
else
{
throw new Exception("Неправильный адрес");
Error = "Некорректный ввод";
}
}
}
public string Error
{
get; private set;
}
public void setExample(string str)
{
Regex rg = new Regex(Pattern);
@ -63,23 +68,26 @@ namespace VisualComponentsLib
private void textBox_Enter(object sender, EventArgs e)
{
int VisibleTime = 2000; //ms
ToolTip tooltip = new ToolTip();
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)
{
Regex rg = new Regex(Pattern);
bool address = rg.IsMatch(emailTextBox.Text);
if (address)
{
emailTextBox.BackColor = Color.Green;
}
else
{
emailTextBox.BackColor = Color.Red;
}
onValueChanged?.Invoke(sender, e);
}
}
}

View File

@ -1,6 +1,6 @@
namespace WinForms
{
partial class Form1
partial class FormForComponents
{
/// <summary>
/// Required designer variable.

View File

@ -1,13 +1,12 @@
using System.Security.Cryptography;
using VisualComponentsLib.Object;
namespace WinForms
{
public partial class Form1 : Form
public partial class FormForComponents : Form
{
List<string> list = new List<string>();
List<Student> students = new List<Student>();
public Form1()
public FormForComponents()
{
list = new List<string>();
list.AddRange(new string[] { "õëåá", "ìîëîêî", "êîëáàñà" });
@ -21,6 +20,11 @@ namespace WinForms
dropDownList.LoadValues(new List<string>() { "ñîê", "ÿáëîêî", "ëóê" });
emailTextBox.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
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)
{

View File

@ -11,7 +11,7 @@ namespace WinForms
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new FormForComponents());
}
}
}