Сижу на паре, ща буду сдавать) если коммитов дальлше нет - сдал
This commit is contained in:
parent
3939413204
commit
1ead8266cc
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Controls.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@ -41,9 +42,16 @@ namespace Controls
|
||||
/// </summary>
|
||||
public void SetTemplateString(string templateString, string startSymbol, string endSymbol)
|
||||
{
|
||||
_templateString = templateString;
|
||||
_startSymbol = startSymbol;
|
||||
_endSymbol = endSymbol;
|
||||
if (templateString != "" && startSymbol != "" && endSymbol != "")
|
||||
{
|
||||
_templateString = templateString;
|
||||
_startSymbol = startSymbol;
|
||||
_endSymbol = endSymbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentNullException("Вы не ввели все значения");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
2
Cop_25/Controls/CustomTextBoxNumber.Designer.cs
generated
2
Cop_25/Controls/CustomTextBoxNumber.Designer.cs
generated
@ -40,6 +40,8 @@
|
||||
textBoxNumber.Size = new Size(213, 27);
|
||||
textBoxNumber.TabIndex = 0;
|
||||
toolTipNumber.SetToolTip(textBoxNumber, "+79378811555");
|
||||
textBoxNumber.Click += textBox_Enter;
|
||||
textBoxNumber.Text = "+79991144333";
|
||||
//
|
||||
// CustomNumberBox
|
||||
//
|
||||
|
@ -27,11 +27,6 @@ namespace Controls
|
||||
/// </summary>
|
||||
private string? _numberPattern;
|
||||
|
||||
/// <summary>
|
||||
/// Шаблон вводимого значения
|
||||
/// </summary>
|
||||
private string? _numberExample = "+79991144333";
|
||||
|
||||
/// <summary>
|
||||
/// Шаблон вводимого значения
|
||||
/// </summary>
|
||||
@ -107,13 +102,13 @@ namespace Controls
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вывод подсказки с примером правильного ввода
|
||||
/// Выведение подсказки на экран
|
||||
/// </summary>
|
||||
private void textBox_Enter(object sender, EventArgs e)
|
||||
{
|
||||
int visibleTime = 2000;
|
||||
ToolTip tooltip = new ToolTip();
|
||||
tooltip.Show(_numberExample, textBoxNumber, 30, -20, visibleTime);
|
||||
tooltip.Show("+79991144333", textBoxNumber, 30, -20, visibleTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
Cop_25/Forms/FormMain.Designer.cs
generated
17
Cop_25/Forms/FormMain.Designer.cs
generated
@ -39,7 +39,6 @@
|
||||
buttonGetBro = new Button();
|
||||
toolTip = new ToolTip(components);
|
||||
button1 = new Button();
|
||||
button2 = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// customTextBoxNumber
|
||||
@ -54,7 +53,7 @@
|
||||
//
|
||||
customComboBox.Location = new Point(2, 19);
|
||||
customComboBox.Name = "customComboBox";
|
||||
customComboBox.SelectedItem = "";
|
||||
customComboBox.SelectedItem = " ";
|
||||
customComboBox.Size = new Size(301, 188);
|
||||
customComboBox.TabIndex = 1;
|
||||
//
|
||||
@ -109,7 +108,7 @@
|
||||
buttonGetBro.Name = "buttonGetBro";
|
||||
buttonGetBro.Size = new Size(273, 29);
|
||||
buttonGetBro.TabIndex = 7;
|
||||
buttonGetBro.Text = "получить альтушку";
|
||||
buttonGetBro.Text = "получить друга";
|
||||
buttonGetBro.UseVisualStyleBackColor = true;
|
||||
buttonGetBro.Click += buttonGetObject_Click;
|
||||
//
|
||||
@ -127,22 +126,11 @@
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
button1.Click += buttonAdd_Click;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.Location = new Point(143, 119);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(94, 29);
|
||||
button2.TabIndex = 9;
|
||||
button2.Text = "очистить";
|
||||
button2.UseVisualStyleBackColor = true;
|
||||
button2.Click += buttonClear_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(buttonGetBro);
|
||||
Controls.Add(buttonValidate);
|
||||
@ -170,6 +158,5 @@
|
||||
private Button buttonGetBro;
|
||||
private ToolTip toolTip;
|
||||
private Button button1;
|
||||
private Button button2;
|
||||
}
|
||||
}
|
@ -19,12 +19,13 @@ namespace Forms
|
||||
InitializeComponent();
|
||||
customComboBox.ComboBoxItems.Add("aboba1");
|
||||
customComboBox.ComboBoxItems.Add("aboba2");
|
||||
customComboBox.SelectedItem = "aboba1";
|
||||
|
||||
customTextBoxNumber.NumPattern = @"^\+7\d{10}$";
|
||||
|
||||
customListBox.SetTemplateString("Имя: {FirstName}, Фамилия: {LastName}, Возраст: {Age}", "{", "}");
|
||||
Person person1 = new Person { FirstName = "{Лена}", LastName = "{Пряникова}", Age = "{18}" };
|
||||
Person person2 = new Person { FirstName = "{Ева}", LastName = "{Конфетковна}", Age = "{20}" };
|
||||
Person person2 = new Person { FirstName = "{Сергей}", LastName = "{Конфеткович}", Age = "{20}" };
|
||||
customListBox.FillProperty(person1, 0, "FirstName");
|
||||
customListBox.FillProperty(person1, 0, "LastName");
|
||||
customListBox.FillProperty(person1, 0, "Age");
|
||||
@ -51,7 +52,7 @@ namespace Forms
|
||||
try
|
||||
{
|
||||
Person selectedPerson = customListBox.GetObjectFromStr<Person>();
|
||||
MessageBox.Show($"Имя: {selectedPerson.FirstName}, Фамилия: {selectedPerson.LastName}, Возраст: {selectedPerson.Age}");
|
||||
MessageBox.Show($"Ваш друг. Имя: {selectedPerson.FirstName}, Фамилия: {selectedPerson.LastName}, Возраст: {selectedPerson.Age}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -59,11 +60,6 @@ namespace Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonClear_Click(object sender, EventArgs e) {
|
||||
customComboBox.ComboBoxClear();
|
||||
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
customComboBox.ComboBoxItems.Add("abobaSECRET");
|
||||
|
Loading…
Reference in New Issue
Block a user