*WIP: Array&ListCollections

This commit is contained in:
Inna Pruidze 2024-04-30 16:45:44 +04:00
parent d01d7cf012
commit 4c2d28dc7f
9 changed files with 405 additions and 49 deletions

View File

@ -1,4 +1,7 @@
namespace WinF_Lab2_Cruiser using System.Net.Http.Headers;
using System.Xml.Linq;
namespace WinF_Lab2_Cruiser
{ {
partial class CollectionForm partial class CollectionForm
{ {
@ -29,6 +32,17 @@
private void InitializeComponent() private void InitializeComponent()
{ {
ToolBox = new GroupBox(); 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(); Check = new Button();
RandomGenerator = new Button(); RandomGenerator = new Button();
RemoveButton = new Button(); RemoveButton = new Button();
@ -42,7 +56,8 @@
SuspendLayout(); SuspendLayout();
// //
// ToolBox // ToolBox
// //
ToolBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; ToolBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
ToolBox.Controls.Add(Check); ToolBox.Controls.Add(Check);
ToolBox.Controls.Add(RandomGenerator); ToolBox.Controls.Add(RandomGenerator);
@ -50,41 +65,99 @@
ToolBox.Controls.Add(maskedTextBox1); ToolBox.Controls.Add(maskedTextBox1);
ToolBox.Controls.Add(Add2Button); ToolBox.Controls.Add(Add2Button);
ToolBox.Controls.Add(AddButton); ToolBox.Controls.Add(AddButton);
ToolBox.Controls.Add(comboBox1); ToolBox.Controls.Add(comboBox1);
ToolBox.Location = new Point(1042, 12);
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.Name = "ToolBox";
ToolBox.Size = new Size(207, 701); ToolBox.Size = new Size(220, 900);
ToolBox.TabIndex = 0; ToolBox.TabIndex = 0;
ToolBox.TabStop = false; ToolBox.TabStop = false;
ToolBox.Text = "Tools"; 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
// //
Check.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Check.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
Check.Location = new Point(34, 629); Check.Location = new Point(34, 824);
Check.Name = "Check"; Check.Name = "Check";
Check.Size = new Size(150, 46); Check.Size = new Size(150, 46);
Check.TabIndex = 6; Check.TabIndex = 2;
Check.Text = "Check"; Check.Text = "Check";
Check.UseVisualStyleBackColor = true; Check.UseVisualStyleBackColor = true;
Check.Click += Check_Click; Check.Click += Check_Click;
// //
// RandomGenerator // RandomGenerator
// //
RandomGenerator.Anchor = AnchorStyles.Right; RandomGenerator.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
RandomGenerator.Location = new Point(34, 391); RandomGenerator.Location = new Point(34, 734);
RandomGenerator.Name = "RandomGenerator"; RandomGenerator.Name = "RandomGenerator";
RandomGenerator.Size = new Size(150, 140); RandomGenerator.Size = new Size(150, 90);
RandomGenerator.TabIndex = 5; RandomGenerator.TabIndex = 3;
RandomGenerator.Text = "Generator Random"; RandomGenerator.Text = "Generator Random";
RandomGenerator.UseVisualStyleBackColor = true; RandomGenerator.UseVisualStyleBackColor = true;
RandomGenerator.Click += RandomGenerator_Click; RandomGenerator.Click += RandomGenerator_Click;
// //
// RemoveButton // RemoveButton
// //
RemoveButton.Location = new Point(34, 275); RemoveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
RemoveButton.Location = new Point(34, 694);
RemoveButton.Name = "RemoveButton"; RemoveButton.Name = "RemoveButton";
RemoveButton.Size = new Size(150, 46); RemoveButton.Size = new Size(150, 40);
RemoveButton.TabIndex = 4; RemoveButton.TabIndex = 4;
RemoveButton.Text = "Delete"; RemoveButton.Text = "Delete";
RemoveButton.UseVisualStyleBackColor = true; RemoveButton.UseVisualStyleBackColor = true;
@ -92,32 +165,34 @@
// //
// maskedTextBox1 // maskedTextBox1
// //
maskedTextBox1.Anchor = AnchorStyles.Right; maskedTextBox1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
maskedTextBox1.Location = new Point(6, 214); maskedTextBox1.Location = new Point(6, 648);
maskedTextBox1.Mask = "00"; maskedTextBox1.Mask = "00";
maskedTextBox1.Name = "maskedTextBox1"; maskedTextBox1.Name = "maskedTextBox1";
maskedTextBox1.Size = new Size(198, 39); maskedTextBox1.Size = new Size(198, 35);
maskedTextBox1.TabIndex = 3; maskedTextBox1.TabIndex = 5;
maskedTextBox1.ValidatingType = typeof(int); maskedTextBox1.ValidatingType = typeof(int);
// //
// Add2Button // Add2Button
// //
Add2Button.Anchor = AnchorStyles.Right; Add2Button.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
Add2Button.Location = new Point(6, 146); Add2Button.Location = new Point(6, 126);
Add2Button.Name = "Add2Button"; Add2Button.Name = "Add2Button";
Add2Button.Size = new Size(198, 46); Add2Button.Size = new Size(198, 40);
Add2Button.TabIndex = 2; Add2Button.TabIndex = 6;
Add2Button.Text = "Advanced"; Add2Button.Text = "Advanced";
Add2Button.UseVisualStyleBackColor = true; Add2Button.UseVisualStyleBackColor = true;
Add2Button.Click += Add2Button_Click; Add2Button.Click += Add2Button_Click;
// //
// AddButton // AddButton
// //
AddButton.Anchor = AnchorStyles.Right; AddButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
AddButton.Location = new Point(6, 94); AddButton.Location = new Point(6, 84);
AddButton.Name = "AddButton"; AddButton.Name = "AddButton";
AddButton.Size = new Size(198, 46); AddButton.Size = new Size(198, 40);
AddButton.TabIndex = 1; AddButton.TabIndex = 7;
AddButton.Text = "Base"; AddButton.Text = "Base";
AddButton.UseVisualStyleBackColor = true; AddButton.UseVisualStyleBackColor = true;
AddButton.Click += AddButton_Click; AddButton.Click += AddButton_Click;
@ -128,10 +203,10 @@
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.FormattingEnabled = true; comboBox1.FormattingEnabled = true;
comboBox1.Items.AddRange(new object[] { "Storage" }); comboBox1.Items.AddRange(new object[] { "Storage" });
comboBox1.Location = new Point(6, 38); comboBox1.Location = new Point(6, 35);
comboBox1.Name = "comboBox1"; comboBox1.Name = "comboBox1";
comboBox1.Size = new Size(198, 40); comboBox1.Size = new Size(198, 40);
comboBox1.TabIndex = 0; comboBox1.TabIndex = 8;
comboBox1.SelectedIndexChanged += comboBox_SelectedIndexChanged; comboBox1.SelectedIndexChanged += comboBox_SelectedIndexChanged;
// //
// pictureBox1 // pictureBox1
@ -140,15 +215,15 @@
pictureBox1.Dock = DockStyle.Left; pictureBox1.Dock = DockStyle.Left;
pictureBox1.Location = new Point(0, 0); pictureBox1.Location = new Point(0, 0);
pictureBox1.Name = "pictureBox1"; pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(1036, 723); pictureBox1.Size = new Size(1020, 860);
pictureBox1.TabIndex = 3; pictureBox1.TabIndex = 9;
pictureBox1.TabStop = false; pictureBox1.TabStop = false;
// //
// CollectionForm // CollectionForm
// //
AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleDimensions = new SizeF(13F, 32F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1259, 723); ClientSize = new Size(1260, 920);
Controls.Add(pictureBox1); Controls.Add(pictureBox1);
Controls.Add(ToolBox); Controls.Add(ToolBox);
Name = "CollectionForm"; Name = "CollectionForm";
@ -162,6 +237,16 @@
#endregion #endregion
private GroupBox ToolBox; 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 ComboBox comboBox1;
private Button AddButton; private Button AddButton;
private Button Add2Button; private Button Add2Button;

View File

@ -16,20 +16,27 @@ namespace WinF_Lab2_Cruiser
{ {
public partial class CollectionForm : Form public partial class CollectionForm : Form
{ {
private AbstractCompany _Company; private readonly StorageCollection<DrawingBase> _storageCollection;
private AbstractCompany? _Company = null;
public CollectionForm() public CollectionForm()
{ {
InitializeComponent(); InitializeComponent();
_storageCollection = new();
} }
private void comboBox_SelectedIndexChanged(object sender, EventArgs e) private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
ToolBox.Enabled = true;
/*
switch (comboBox1.Text) switch (comboBox1.Text)
{ {
case "Storage": case "Storage":
_Company = new NewClassCollection(pictureBox1.Width, pictureBox1.Height, new ArrayAlg<DrawingBase>()); _Company = new NewClassCollection(pictureBox1.Width, pictureBox1.Height, new ArrayAlg<DrawingBase>());
break; break;
} }
*/
} }
private static Color GetColor(Random r) private static Color GetColor(Random r)
@ -50,7 +57,7 @@ namespace WinF_Lab2_Cruiser
return; return;
} }
Random rn = new Random(); Random rn = new();
DrawingBase Transport; DrawingBase Transport;
switch (type) switch (type)
{ {
@ -67,7 +74,7 @@ namespace WinF_Lab2_Cruiser
return; return;
} }
if (_Company + Transport > 0) if (_Company + Transport >= 0)
{ {
MessageBox.Show("> Object was added"); MessageBox.Show("> Object was added");
pictureBox1.Image = _Company.Show(); pictureBox1.Image = _Company.Show();
@ -93,7 +100,7 @@ namespace WinF_Lab2_Cruiser
{ {
return; return;
} }
if (_Company - Convert.ToInt32(maskedTextBox1.Text) != null) if ((_Company - Convert.ToInt32(maskedTextBox1.Text)) != null)
{ {
MessageBox.Show("> Object was removed"); MessageBox.Show("> Object was removed");
pictureBox1.Image = _Company.Show(); pictureBox1.Image = _Company.Show();
@ -147,5 +154,83 @@ namespace WinF_Lab2_Cruiser
} }
pictureBox1.Image = _Company.Show(); 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<DrawingBase>? 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();
}
} }
} }

View File

@ -29,10 +29,10 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects
} }
// insted of bool: // insted of bool:
public static int operator +(AbstractCompany cmp, public static int operator +(AbstractCompany cmp,
DrawingBase trasport) => (cmp._Array.Insert(trasport)); DrawingBase trasport) => (cmp._Array.Insert(trasport));
public static DrawingBase operator -(AbstractCompany cmp, public static DrawingBase operator -(AbstractCompany cmp,
int pos) => (cmp._Array.Remove(pos)); int pos) => (cmp._Array.Remove(pos));
public DrawingBase? GetRandomObj() public DrawingBase? GetRandomObj()

View File

@ -19,7 +19,20 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects
public int Count => _Array.Length; 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) public K? GetItem(int index)
{ {
@ -33,7 +46,7 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects
public int Insert(K item) public int Insert(K item)
{ {
// any empty place // any empty place
for (int i = 0; i < Count; i++) for (int i = 0; i <= Count; i++)
{ {
if (_Array[i] == null) if (_Array[i] == null)
{ {
@ -64,14 +77,12 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects
min_index = i; min_index = i;
} }
} }
_Array[min_index] = item; _Array[min_index] = item;
return min_index; return min_index;
} }
return -1; return -1;
} }
public K Remove(int index) public K Remove(int index)
{ {
K item; K item;
@ -83,7 +94,7 @@ namespace WinF_Lab2_Cruiser.CollectionGenericObjects
} }
return null; return null;
} }
/* /*
public bool Remove(int index) public bool Remove(int index)
{ {

View File

@ -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
}
}

View File

@ -6,9 +6,8 @@ using System.Threading.Tasks;
namespace WinF_Lab2_Cruiser.CollectionGenericObjects namespace WinF_Lab2_Cruiser.CollectionGenericObjects
{ {
public interface ICGO<K> // U> public interface ICGO<K>
where K : class // ссылочный тип where K : class // ссылочный тип
// where U : struct // 2nd dop task
{ {
int Count { get; } int Count { get; }
int SetMaxCount { set; } int SetMaxCount { set; }

View File

@ -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<K> : ICGO<K> where K : class
{
private readonly List<K?> _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;
}
}
}

View File

@ -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<T> where T : class
{
private Dictionary<string, ICGO<T>> _storage;
public List<string> Keys => _storage.Keys.ToList();
public StorageCollection()
{
_storage = new Dictionary<string, ICGO<T>>();
}
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<T>()); break; // ------------------------------------------------ [ !!! ]
case CollectionType.List : _storage[name] = new ListGenericObjects<T>(); break;
}
}
public void DelCollection(string name)
{
if (_storage.ContainsKey(name)) _storage.Remove(name);
return;
}
public ICGO<T>? 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;
}
}
}
}

View File

@ -30,6 +30,8 @@ namespace WinF_Lab2_Cruiser
private void InitializeComponent() private void InitializeComponent()
{ {
pictureBox1 = new PictureBox(); pictureBox1 = new PictureBox();
//CreateButton = new Button();
//CreateButton2 = new Button();
buttonUp = new Button(); buttonUp = new Button();
buttonLeft = new Button(); buttonLeft = new Button();
buttonDown = new Button(); buttonDown = new Button();
@ -50,6 +52,31 @@ namespace WinF_Lab2_Cruiser
pictureBox1.TabIndex = 0; pictureBox1.TabIndex = 0;
pictureBox1.TabStop = false; 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
// //
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
@ -102,6 +129,9 @@ namespace WinF_Lab2_Cruiser
buttonRight.UseVisualStyleBackColor = true; buttonRight.UseVisualStyleBackColor = true;
buttonRight.Click += ButtonMove_Click; buttonRight.Click += ButtonMove_Click;
// //
// ListComboBox
//
//
// ButtonActivate // ButtonActivate
// //
ButtonActivate.Anchor = AnchorStyles.Right; ButtonActivate.Anchor = AnchorStyles.Right;
@ -113,18 +143,18 @@ namespace WinF_Lab2_Cruiser
ButtonActivate.UseVisualStyleBackColor = true; ButtonActivate.UseVisualStyleBackColor = true;
ButtonActivate.Click += comboBox_Activate; ButtonActivate.Click += comboBox_Activate;
// //
// comboBox // comboBox1
// //
comboBox.FormattingEnabled = true; comboBox.FormattingEnabled = true;
comboBox.Items.AddRange(new object[] { "Center", "Boarder" }); comboBox.Items.AddRange(new object[] { "Center", "Boarder" });
comboBox.Location = new Point(22, 27); comboBox.Location = new Point(188, 26);
comboBox.Name = "comboBox"; comboBox.Name = "Directions";
comboBox.Size = new Size(203, 40); comboBox.Size = new Size(203, 40);
comboBox.TabIndex = 9; comboBox.TabIndex = 9;
// //
// Activate // Activate
// //
Activate.Location = new Point(22, 84); Activate.Location = new Point(188, 93);
Activate.Name = "Activate"; Activate.Name = "Activate";
Activate.Size = new Size(203, 46); Activate.Size = new Size(203, 46);
Activate.TabIndex = 10; Activate.TabIndex = 10;
@ -145,6 +175,8 @@ namespace WinF_Lab2_Cruiser
Controls.Add(buttonDown); Controls.Add(buttonDown);
Controls.Add(buttonLeft); Controls.Add(buttonLeft);
Controls.Add(buttonUp); Controls.Add(buttonUp);
//Controls.Add(CreateButton);
//Controls.Add(CreateButton2);
Controls.Add(pictureBox1); Controls.Add(pictureBox1);
Controls.Add(ButtonActivate); Controls.Add(ButtonActivate);
Margin = new Padding(4, 2, 4, 2); Margin = new Padding(4, 2, 4, 2);