From 4c2d28dc7f039ba58970f70597bb4b265197f912 Mon Sep 17 00:00:00 2001 From: DelphyAlmond Date: Tue, 30 Apr 2024 16:45:44 +0400 Subject: [PATCH] *WIP: Array&ListCollections --- .../CollectionForm.Designer.cs | 147 ++++++++++++++---- .../WinF_Lab2_Cruiser/CollectionForm.cs | 93 ++++++++++- .../AbstractCompany.cs | 4 +- .../CollectionGenericObjects/ArrayAlg.cs | 23 ++- .../CollectionType.cs | 15 ++ .../CollectionGenericObjects/ICGO.cs | 3 +- .../ListGenericObjects.cs | 68 ++++++++ .../StorageCollection.cs | 61 ++++++++ .../DrawingCanvas.Designer.cs | 40 ++++- 9 files changed, 405 insertions(+), 49 deletions(-) create mode 100644 WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/CollectionType.cs create mode 100644 WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ListGenericObjects.cs create mode 100644 WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/StorageCollection.cs diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.Designer.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.Designer.cs index 26e7951..3c99b6b 100644 --- a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.Designer.cs +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.Designer.cs @@ -1,4 +1,7 @@ -namespace WinF_Lab2_Cruiser +using System.Net.Http.Headers; +using System.Xml.Linq; + +namespace WinF_Lab2_Cruiser { partial class CollectionForm { @@ -29,6 +32,17 @@ private void InitializeComponent() { ToolBox = new GroupBox(); + StorageBox = new GroupBox(); + + // labelCollections = new Label(); + TextBoxC = new TextBox(); + ArrayRB = new RadioButton(); + ListRB = new RadioButton(); + ButtonAL = new Button(); + Elements = new ListBox(); + ButtonDelAL = new Button(); + CreateCompany = new Button(); + Check = new Button(); RandomGenerator = new Button(); RemoveButton = new Button(); @@ -42,7 +56,8 @@ SuspendLayout(); // // ToolBox - // + // + ToolBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; ToolBox.Controls.Add(Check); ToolBox.Controls.Add(RandomGenerator); @@ -50,41 +65,99 @@ ToolBox.Controls.Add(maskedTextBox1); ToolBox.Controls.Add(Add2Button); ToolBox.Controls.Add(AddButton); - ToolBox.Controls.Add(comboBox1); - ToolBox.Location = new Point(1042, 12); + ToolBox.Controls.Add(comboBox1); + + ToolBox.Controls.Add(StorageBox); + ToolBox.Controls.Add(CreateCompany); + + CreateCompany.Location = new Point(10, 540); + CreateCompany.Size = new Size(190, 80); + CreateCompany.Text = "Create company"; + CreateCompany.Click += ButtonCreateCompany_Click; + + ToolBox.Location = new Point(1030, 12); ToolBox.Name = "ToolBox"; - ToolBox.Size = new Size(207, 701); + ToolBox.Size = new Size(220, 900); ToolBox.TabIndex = 0; ToolBox.TabStop = false; ToolBox.Text = "Tools"; + + StorageBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + StorageBox.Location = new Point(8, 180); + StorageBox.Size = new Size(204, 350); + StorageBox.TabIndex = 1; + StorageBox.Text = "Collections Name:"; + + StorageBox.Controls.Add(TextBoxC); + TextBoxC.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + TextBoxC.Location = new Point(7, 70); + TextBoxC.Size = new Size(180, 46); + TextBoxC.TabIndex = 10; + + StorageBox.Controls.Add(ArrayRB); + ArrayRB.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + ArrayRB.Location = new Point(4, 118); + ArrayRB.Size = new Size(100, 40); + ArrayRB.TabIndex = 11; + ArrayRB.Text = "Array"; + + StorageBox.Controls.Add(ListRB); + ListRB.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + ListRB.Location = new Point(96, 118); + ListRB.Size = new Size(80, 40); + ListRB.TabIndex = 12; + ListRB.Text = "List"; + + StorageBox.Controls.Add(ButtonAL); + ButtonAL.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + ButtonAL.Location = new Point(6, 160); + ButtonAL.Size = new Size(180, 40); + ButtonAL.TabIndex = 13; + ButtonAL.Text = "Add collection"; + ButtonAL.Click += ButtonCollectionAdd_Click; + + StorageBox.Controls.Add(Elements); + Elements.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + Elements.Location = new Point(6, 200); + Elements.Size = new Size(180, 100); + + StorageBox.Controls.Add(ButtonDelAL); + ButtonDelAL.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + ButtonDelAL.Location = new Point(6, 300); + ButtonDelAL.Size = new Size(180, 40); + ButtonDelAL.TabIndex = 14; + ButtonDelAL.Text = "Remove"; + ButtonDelAL.Click += ButtonCollectionDel_Click; + // // Check // Check.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - Check.Location = new Point(34, 629); + Check.Location = new Point(34, 824); Check.Name = "Check"; Check.Size = new Size(150, 46); - Check.TabIndex = 6; + Check.TabIndex = 2; Check.Text = "Check"; Check.UseVisualStyleBackColor = true; Check.Click += Check_Click; // // RandomGenerator // - RandomGenerator.Anchor = AnchorStyles.Right; - RandomGenerator.Location = new Point(34, 391); + RandomGenerator.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + RandomGenerator.Location = new Point(34, 734); RandomGenerator.Name = "RandomGenerator"; - RandomGenerator.Size = new Size(150, 140); - RandomGenerator.TabIndex = 5; + RandomGenerator.Size = new Size(150, 90); + RandomGenerator.TabIndex = 3; RandomGenerator.Text = "Generator Random"; RandomGenerator.UseVisualStyleBackColor = true; RandomGenerator.Click += RandomGenerator_Click; // // RemoveButton - // - RemoveButton.Location = new Point(34, 275); + // + RemoveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + RemoveButton.Location = new Point(34, 694); RemoveButton.Name = "RemoveButton"; - RemoveButton.Size = new Size(150, 46); + RemoveButton.Size = new Size(150, 40); RemoveButton.TabIndex = 4; RemoveButton.Text = "Delete"; RemoveButton.UseVisualStyleBackColor = true; @@ -92,32 +165,34 @@ // // maskedTextBox1 // - maskedTextBox1.Anchor = AnchorStyles.Right; - maskedTextBox1.Location = new Point(6, 214); + maskedTextBox1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + maskedTextBox1.Location = new Point(6, 648); maskedTextBox1.Mask = "00"; maskedTextBox1.Name = "maskedTextBox1"; - maskedTextBox1.Size = new Size(198, 39); - maskedTextBox1.TabIndex = 3; + maskedTextBox1.Size = new Size(198, 35); + maskedTextBox1.TabIndex = 5; maskedTextBox1.ValidatingType = typeof(int); + + // // Add2Button // - Add2Button.Anchor = AnchorStyles.Right; - Add2Button.Location = new Point(6, 146); + Add2Button.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + Add2Button.Location = new Point(6, 126); Add2Button.Name = "Add2Button"; - Add2Button.Size = new Size(198, 46); - Add2Button.TabIndex = 2; + Add2Button.Size = new Size(198, 40); + Add2Button.TabIndex = 6; Add2Button.Text = "Advanced"; Add2Button.UseVisualStyleBackColor = true; Add2Button.Click += Add2Button_Click; // // AddButton // - AddButton.Anchor = AnchorStyles.Right; - AddButton.Location = new Point(6, 94); + AddButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + AddButton.Location = new Point(6, 84); AddButton.Name = "AddButton"; - AddButton.Size = new Size(198, 46); - AddButton.TabIndex = 1; + AddButton.Size = new Size(198, 40); + AddButton.TabIndex = 7; AddButton.Text = "Base"; AddButton.UseVisualStyleBackColor = true; AddButton.Click += AddButton_Click; @@ -128,10 +203,10 @@ comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; comboBox1.FormattingEnabled = true; comboBox1.Items.AddRange(new object[] { "Storage" }); - comboBox1.Location = new Point(6, 38); + comboBox1.Location = new Point(6, 35); comboBox1.Name = "comboBox1"; comboBox1.Size = new Size(198, 40); - comboBox1.TabIndex = 0; + comboBox1.TabIndex = 8; comboBox1.SelectedIndexChanged += comboBox_SelectedIndexChanged; // // pictureBox1 @@ -140,15 +215,15 @@ pictureBox1.Dock = DockStyle.Left; pictureBox1.Location = new Point(0, 0); pictureBox1.Name = "pictureBox1"; - pictureBox1.Size = new Size(1036, 723); - pictureBox1.TabIndex = 3; + pictureBox1.Size = new Size(1020, 860); + pictureBox1.TabIndex = 9; pictureBox1.TabStop = false; // // CollectionForm // AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1259, 723); + ClientSize = new Size(1260, 920); Controls.Add(pictureBox1); Controls.Add(ToolBox); Name = "CollectionForm"; @@ -162,6 +237,16 @@ #endregion private GroupBox ToolBox; + private GroupBox StorageBox; + // private Label labelCollections; + private TextBox TextBoxC; + private RadioButton ArrayRB; + private RadioButton ListRB; + private Button ButtonAL; + private ListBox Elements; + private Button ButtonDelAL; + private Button CreateCompany; + private ComboBox comboBox1; private Button AddButton; private Button Add2Button; diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.cs index 8418766..b750b7e 100644 --- a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.cs +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionForm.cs @@ -16,20 +16,27 @@ namespace WinF_Lab2_Cruiser { public partial class CollectionForm : Form { - private AbstractCompany _Company; + private readonly StorageCollection _storageCollection; + + private AbstractCompany? _Company = null; public CollectionForm() { InitializeComponent(); + _storageCollection = new(); } private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { + ToolBox.Enabled = true; + + /* switch (comboBox1.Text) { case "Storage": _Company = new NewClassCollection(pictureBox1.Width, pictureBox1.Height, new ArrayAlg()); break; } + */ } private static Color GetColor(Random r) @@ -50,7 +57,7 @@ namespace WinF_Lab2_Cruiser return; } - Random rn = new Random(); + Random rn = new(); DrawingBase Transport; switch (type) { @@ -67,7 +74,7 @@ namespace WinF_Lab2_Cruiser return; } - if (_Company + Transport > 0) + if (_Company + Transport >= 0) { MessageBox.Show("> Object was added"); pictureBox1.Image = _Company.Show(); @@ -93,7 +100,7 @@ namespace WinF_Lab2_Cruiser { return; } - if (_Company - Convert.ToInt32(maskedTextBox1.Text) != null) + if ((_Company - Convert.ToInt32(maskedTextBox1.Text)) != null) { MessageBox.Show("> Object was removed"); pictureBox1.Image = _Company.Show(); @@ -147,5 +154,83 @@ namespace WinF_Lab2_Cruiser } pictureBox1.Image = _Company.Show(); } + + private void ButtonCollectionAdd_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(TextBoxC.Text) || (!ListRB.Checked && !ArrayRB.Checked)) + { + MessageBox.Show("Enter correct data or choose an option", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + CollectionType collType = CollectionType.None; + + if (ArrayRB.Checked) + { + collType = CollectionType.Array; + } + else if (ListRB.Checked) + { + collType = CollectionType.List; + } + + _storageCollection.AddCollection(TextBoxC.Text, collType); + RefreshListBoxItems(); + } + + private void RefreshListBoxItems() + { + Elements.Items.Clear(); + for (int i = 0; i < _storageCollection.Keys?.Count; ++i) + { + string? collName = _storageCollection.Keys?[i]; + if (!string.IsNullOrEmpty(collName)) + { + Elements.Items.Add(collName); + } + } + } + + private void ButtonCollectionDel_Click(object sender, EventArgs e) + { + if (Elements.SelectedItem == null || Elements.SelectedIndex < 0) + { + MessageBox.Show("Collection was not choosed"); + return; + } + if (MessageBox.Show("Are you sure?", "Removing", MessageBoxButtons.OK, MessageBoxIcon.Question) != DialogResult.OK) + { + return; + } + _storageCollection.DelCollection(Elements.SelectedItem.ToString()); + RefreshListBoxItems(); + } + + private void ButtonCreateCompany_Click(object sender, EventArgs e) + { + if (Elements.SelectedIndex < 0 || Elements.SelectedItem == null) + { + MessageBox.Show("Collection was not choosed"); + return; + } + + ICGO? collection = _storageCollection[Elements.SelectedItem.ToString() ?? string.Empty]; + if (collection == null) + { + MessageBox.Show("Collection is not initialized"); + return; + } + + switch (comboBox1.Text) + { + case "Storage": + _Company = new NewClassCollection(pictureBox1.Width, pictureBox1.Height, collection); + break; + } + + ToolBox.Enabled = true; + RefreshListBoxItems(); + } } } + diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/AbstractCompany.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/AbstractCompany.cs index 84f3197..b607954 100644 --- a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/AbstractCompany.cs +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/AbstractCompany.cs @@ -29,10 +29,10 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects } // insted of bool: - public static int operator +(AbstractCompany cmp, + public static int operator +(AbstractCompany cmp, DrawingBase trasport) => (cmp._Array.Insert(trasport)); - public static DrawingBase operator -(AbstractCompany cmp, + public static DrawingBase operator -(AbstractCompany cmp, int pos) => (cmp._Array.Remove(pos)); public DrawingBase? GetRandomObj() diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ArrayAlg.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ArrayAlg.cs index 4d93e81..39a9a1e 100644 --- a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ArrayAlg.cs +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ArrayAlg.cs @@ -19,7 +19,20 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects public int Count => _Array.Length; - public int SetMaxCount { set { if (value > 0) { _Array = new K?[value]; } } } + public int SetMaxCount { set { + if (value > 0) + { + if (_Array.Length > 0) + { + Array.Resize(ref _Array, value); + } + else + { + _Array = new K?[value]; + } + } + } + } public K? GetItem(int index) { @@ -33,7 +46,7 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects public int Insert(K item) { // any empty place - for (int i = 0; i < Count; i++) + for (int i = 0; i <= Count; i++) { if (_Array[i] == null) { @@ -64,14 +77,12 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects min_index = i; } } - _Array[min_index] = item; return min_index; } - return -1; } - + public K Remove(int index) { K item; @@ -83,7 +94,7 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects } return null; } - + /* public bool Remove(int index) { diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/CollectionType.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/CollectionType.cs new file mode 100644 index 0000000..9d127d2 --- /dev/null +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/CollectionType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinF_Lab2_Cruiser.CollectionGenericObjects +{ + public enum CollectionType + { + None = 0, + Array = 1, + List = 2 + } +} diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ICGO.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ICGO.cs index a2b7902..56bcf43 100644 --- a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ICGO.cs +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ICGO.cs @@ -6,9 +6,8 @@ using System.Threading.Tasks; namespace WinF_Lab2_Cruiser.CollectionGenericObjects { - public interface ICGO // U> + public interface ICGO where K : class // ссылочный тип - // where U : struct // 2nd dop task { int Count { get; } int SetMaxCount { set; } diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ListGenericObjects.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ListGenericObjects.cs new file mode 100644 index 0000000..4f3eccd --- /dev/null +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/ListGenericObjects.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace WinF_Lab2_Cruiser.CollectionGenericObjects +{ + public class ListGenericObjects : ICGO where K : class + { + private readonly List _collection; + private int _maxCount; + public int Count => _collection.Count; + + public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } } + + public ListGenericObjects() + { + _collection = new(); + } + + public K? GetItem(int index) + { + if (index >= Count || index < 0) + { + return null; + } + return _collection[index]; + } + + public int Insert(K item) + { + if (item == null) // unneccesary + { + return -1; // [!] not 0, + // 'cause 0 can be an index of item + } + + _collection.Add(item); + return _collection.Count; + } + + public int Insert(int index, K item) + { + if (index >= _maxCount || index < 0 || _collection[index] != null) + { + return -1; + } + + _collection.Insert(index, item); + return index; + } + + public K? Remove(int index) + { + if (index >= Count || index < 0) // on the other positions item doesn't exist + { + return null; + } + + K item = _collection[index]; + _collection.RemoveAt(index); + return item; + } + } +} + diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/StorageCollection.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/StorageCollection.cs new file mode 100644 index 0000000..925e0dc --- /dev/null +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/CollectionGenericObjects/StorageCollection.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WinF_Lab2_Cruiser.Drawing_tools; + +namespace WinF_Lab2_Cruiser.CollectionGenericObjects +{ + public class StorageCollection where T : class + { + private Dictionary> _storage; + public List Keys => _storage.Keys.ToList(); + public StorageCollection() + { + _storage = new Dictionary>(); + } + + public void AddCollection(string name, CollectionType CollType) + { + if (name == null || _storage.ContainsKey(name) || CollType == CollectionType.None) + { + return; + } + + switch (CollType) + { + case CollectionType.Array : _storage.Add(name, new ArrayAlg()); break; // ------------------------------------------------ [ !!! ] + case CollectionType.List : _storage[name] = new ListGenericObjects(); break; + } + } + + public void DelCollection(string name) + { + if (_storage.ContainsKey(name)) _storage.Remove(name); + return; + } + + public ICGO? this[string name] // int i + { + get + { + /* + int k = 0; + foreach (string key in Keys) + { + if (k >= i) + { + if (_storage.ContainsKey(Keys[k])) return _storage[name]; + return null; + } + k++; + } + */ + + if (_storage.ContainsKey(name)) return _storage[name]; + return null; + } + } + } +} diff --git a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/DrawingCanvas.Designer.cs b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/DrawingCanvas.Designer.cs index 471e3b8..b286fc4 100644 --- a/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/DrawingCanvas.Designer.cs +++ b/WinF_Lab2_Cruiser/WinF_Lab2_Cruiser/DrawingCanvas.Designer.cs @@ -30,6 +30,8 @@ namespace WinF_Lab2_Cruiser private void InitializeComponent() { pictureBox1 = new PictureBox(); + //CreateButton = new Button(); + //CreateButton2 = new Button(); buttonUp = new Button(); buttonLeft = new Button(); buttonDown = new Button(); @@ -50,6 +52,31 @@ namespace WinF_Lab2_Cruiser pictureBox1.TabIndex = 0; pictureBox1.TabStop = false; // + // CreateButton + // + /* + CreateButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + CreateButton.Location = new Point(22, 465); + CreateButton.Margin = new Padding(6); + CreateButton.Name = "CreateButton"; + CreateButton.Size = new Size(139, 113); + CreateButton.TabIndex = 1; + CreateButton.Text = "Create object"; + CreateButton.UseVisualStyleBackColor = true; + CreateButton.Click += buttonCr_Click; + // + // CreateButton2 + // + CreateButton2.Location = new Point(22, 26); + CreateButton2.Margin = new Padding(6); + CreateButton2.Name = "CreateButton2"; + CreateButton2.Size = new Size(139, 113); + CreateButton2.TabIndex = 2; + CreateButton2.Text = "Cr Updated Object"; + CreateButton2.UseVisualStyleBackColor = true; + CreateButton2.Click += buttonCr2_Click; + */ + // // buttonUp // buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; @@ -102,6 +129,9 @@ namespace WinF_Lab2_Cruiser buttonRight.UseVisualStyleBackColor = true; buttonRight.Click += ButtonMove_Click; // + // ListComboBox + // + // // ButtonActivate // ButtonActivate.Anchor = AnchorStyles.Right; @@ -113,18 +143,18 @@ namespace WinF_Lab2_Cruiser ButtonActivate.UseVisualStyleBackColor = true; ButtonActivate.Click += comboBox_Activate; // - // comboBox + // comboBox1 // comboBox.FormattingEnabled = true; comboBox.Items.AddRange(new object[] { "Center", "Boarder" }); - comboBox.Location = new Point(22, 27); - comboBox.Name = "comboBox"; + comboBox.Location = new Point(188, 26); + comboBox.Name = "Directions"; comboBox.Size = new Size(203, 40); comboBox.TabIndex = 9; // // Activate // - Activate.Location = new Point(22, 84); + Activate.Location = new Point(188, 93); Activate.Name = "Activate"; Activate.Size = new Size(203, 46); Activate.TabIndex = 10; @@ -145,6 +175,8 @@ namespace WinF_Lab2_Cruiser Controls.Add(buttonDown); Controls.Add(buttonLeft); Controls.Add(buttonUp); + //Controls.Add(CreateButton); + //Controls.Add(CreateButton2); Controls.Add(pictureBox1); Controls.Add(ButtonActivate); Margin = new Padding(4, 2, 4, 2);