фикс 2-го компонента
This commit is contained in:
parent
3b31a57033
commit
bee04958e0
2
TestView/Form1.Designer.cs
generated
2
TestView/Form1.Designer.cs
generated
@ -86,8 +86,6 @@
|
|||||||
// input_text
|
// input_text
|
||||||
//
|
//
|
||||||
input_text.Location = new Point(312, 12);
|
input_text.Location = new Point(312, 12);
|
||||||
input_text.MaxLen = null;
|
|
||||||
input_text.MinLen = null;
|
|
||||||
input_text.Name = "input_text";
|
input_text.Name = "input_text";
|
||||||
input_text.Size = new Size(240, 119);
|
input_text.Size = new Size(240, 119);
|
||||||
input_text.TabIndex = 5;
|
input_text.TabIndex = 5;
|
||||||
|
@ -11,10 +11,11 @@ namespace TestView
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string str = "ïåðâûé âòîðîé òðåòèé ÷åòâ¸ðòûé";
|
|
||||||
|
|
||||||
list_with_choice.Fill_List(str);
|
list_with_choice.Fill_List("ïåðâûé");
|
||||||
list_with_choice.Element = "ïåðâûé";
|
list_with_choice.Fill_List("âòîðîé");
|
||||||
|
list_with_choice.Fill_List("òðåòèé");
|
||||||
|
list_with_choice.Fill_List("÷åòâ¸ðòûé");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonClear_Click(object sender, EventArgs e)
|
private void buttonClear_Click(object sender, EventArgs e)
|
||||||
@ -37,12 +38,12 @@ namespace TestView
|
|||||||
input_text.MinLen = 5;
|
input_text.MinLen = 5;
|
||||||
input_text.MaxLen = 25;
|
input_text.MaxLen = 25;
|
||||||
|
|
||||||
MessageBox.Show($"Min: {input_text.minlen}; Max: {input_text.maxlen}");
|
MessageBox.Show($"Min: {input_text.MinLen}; Max: {input_text.MaxLen}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonVal_Click(object sender, EventArgs e)
|
private void buttonVal_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
input_text.Element = "Ïðîâåðêà";
|
input_text.Element = "Sample text";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void input_text_ItemChange(string obj)
|
private void input_text_ItemChange(string obj)
|
||||||
@ -54,8 +55,12 @@ namespace TestView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string val = input_text.Element;
|
if (input_text.Element.Equals("Range exeption"))
|
||||||
MessageBox.Show(val, "×åðåç ñâîéñòâî");
|
throw new TextBoundsNotSetExeption("Äèàïàçîí íå çàäàí");
|
||||||
|
if (input_text.Element.Equals("Value exeption"))
|
||||||
|
throw new TextOutOfBoundsExeption("Ñëîâî âíå äèàïàçîíà");
|
||||||
|
|
||||||
|
MessageBox.Show(input_text.Element, "×åðåç ñâîéñòâî");
|
||||||
}
|
}
|
||||||
catch (TextBoundsNotSetExeption ex)
|
catch (TextBoundsNotSetExeption ex)
|
||||||
{
|
{
|
||||||
@ -96,7 +101,7 @@ namespace TestView
|
|||||||
|
|
||||||
private void buttonSetIndex_Click(object sender, EventArgs e)
|
private void buttonSetIndex_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
myTreeView.SelectedNodeIndex = 1;û
|
myTreeView.SelectedNodeIndex = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Form1_Load(object sender, EventArgs e)
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
@ -20,58 +20,25 @@ namespace ViewComponents
|
|||||||
}
|
}
|
||||||
|
|
||||||
public event Action<string?> ItemChange;
|
public event Action<string?> ItemChange;
|
||||||
private bool isMin = false;
|
|
||||||
private bool isMax = false;
|
public int MinLen { get; set; } = -1;
|
||||||
|
public int MaxLen { get; set; } = -1;
|
||||||
public int? minlen;
|
|
||||||
public int? maxlen;
|
public string Element
|
||||||
public string? Element
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!isMax || !isMin) throw new TextBoundsNotSetExeption("Диапазон не задан");
|
if (MinLen < 0 || MaxLen < 0) return "Range exeption";
|
||||||
if(textBox1.Text.Length < minlen || textBox1.Text.Length > maxlen) throw new TextOutOfBoundsExeption("Слово не из диапазона");
|
if (textBox1.Text.Length < MinLen || textBox1.Text.Length > MaxLen) return "Value exeption";
|
||||||
return textBox1.Text;
|
return textBox1.Text;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (isMin && isMax && value != null && value.Length >= minlen && value.Length <= maxlen) textBox1.Text = value;
|
if (MinLen >= 0 && MaxLen >= 0 && value != null && value.Length >= MinLen && value.Length <= MaxLen) textBox1.Text = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int? MinLen
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (isMin == true) return minlen;
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value.HasValue)
|
|
||||||
{
|
|
||||||
minlen = value;
|
|
||||||
isMin = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int? MaxLen
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (isMax == true) return maxlen;
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value.HasValue)
|
|
||||||
{
|
|
||||||
maxlen = value;
|
|
||||||
isMax = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -37,15 +37,10 @@ namespace ViewComponents
|
|||||||
{
|
{
|
||||||
if (str == null)
|
if (str == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Вы не ввели строку");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] list = str.Split(' ');
|
checkedListBox1.Items.Add(str);
|
||||||
foreach (string s in list)
|
|
||||||
{
|
|
||||||
checkedListBox1.Items.Add(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void Clean_List() //метод очистки списка
|
public void Clean_List() //метод очистки списка
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user