сдано

This commit is contained in:
annalyovushkina@yandex.ru 2024-09-23 12:53:35 +04:00
parent 37673c4961
commit 5d21dc1cde
4 changed files with 14 additions and 6 deletions

View File

@ -38,7 +38,7 @@
textBox.Size = new Size(263, 27); textBox.Size = new Size(263, 27);
textBox.TabIndex = 0; textBox.TabIndex = 0;
textBox.TextChanged += textBox_TextChanged; textBox.TextChanged += textBox_TextChanged;
textBox.Enter += textBox_Enter; //textBox.Enter += textBox_Enter;
// //
// CustomComboBox // CustomComboBox
// //

View File

@ -17,6 +17,7 @@ namespace KOP_Labs
{ {
InitializeComponent(); InitializeComponent();
} }
public int? MinValue { get; set; } public int? MinValue { get; set; }
public int? MaxValue { get; set; } public int? MaxValue { get; set; }
@ -45,7 +46,7 @@ namespace KOP_Labs
} }
else else
{ {
textBox.ForeColor = Color.Black; textBox.ForeColor = Color.Green;
} }
} }

View File

@ -44,8 +44,11 @@ namespace KOP_Labs
public void AddObjectToTree<T>(T obj) public void AddObjectToTree<T>(T obj)
{ {
if (hierarchy == null)
{
throw new HierarcyNullException("Иерархия не задана");
}
TreeNode currentNode = treeView.Nodes.Count > 0 ? treeView.Nodes[0] : treeView.Nodes.Add(""); TreeNode currentNode = treeView.Nodes.Count > 0 ? treeView.Nodes[0] : treeView.Nodes.Add("");
foreach (var property in hierarchy) foreach (var property in hierarchy)
{ {
var value = obj.GetType().GetProperty(property).GetValue(obj, null).ToString(); var value = obj.GetType().GetProperty(property).GetValue(obj, null).ToString();
@ -63,6 +66,10 @@ namespace KOP_Labs
public T GetSelectedObject<T>() where T : new() public T GetSelectedObject<T>() where T : new()
{ {
if (hierarchy == null)
{
throw new HierarcyNullException("Иерархия не задана");
}
if (treeView.SelectedNode == null) if (treeView.SelectedNode == null)
{ {
throw new InvalidOperationException("Узел не выбран"); throw new InvalidOperationException("Узел не выбран");

View File

@ -42,8 +42,8 @@
// customComboBox1 // customComboBox1
// //
customComboBox1.Location = new Point(264, 50); customComboBox1.Location = new Point(264, 50);
customComboBox1.Max = 20; customComboBox1.MaxValue = 20;
customComboBox1.Min = 5; customComboBox1.MinValue = 5;
customComboBox1.Name = "customComboBox1"; customComboBox1.Name = "customComboBox1";
customComboBox1.Size = new Size(301, 125); customComboBox1.Size = new Size(301, 125);
customComboBox1.TabIndex = 0; customComboBox1.TabIndex = 0;