Этап 3. Форма

This commit is contained in:
Дарья Антонова 2022-12-16 22:59:45 +04:00
parent 4942c6bf61
commit d9b0e7a3ce
2 changed files with 335 additions and 136 deletions

View File

@ -28,170 +28,288 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.buttonDown1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.buttonAddMap = new System.Windows.Forms.Button();
this.listBoxMaps = new System.Windows.Forms.ListBox();
this.ButtonDeleteMap = new System.Windows.Forms.Button();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.buttonRight1 = new System.Windows.Forms.Button();
this.buttonLeft1 = new System.Windows.Forms.Button();
this.buttonUp1 = new System.Windows.Forms.Button();
this.ButtonShowOnMap = new System.Windows.Forms.Button(); this.ButtonShowOnMap = new System.Windows.Forms.Button();
this.ButtonShowStorage = new System.Windows.Forms.Button(); this.ButtonShowStorage = new System.Windows.Forms.Button();
this.ButtonRemoveJet = new System.Windows.Forms.Button();
this.maskedTextBoxPosition = new System.Windows.Forms.TextBox(); this.maskedTextBoxPosition = new System.Windows.Forms.TextBox();
this.ButtonAddJet = new System.Windows.Forms.Button(); this.ButtonAddJet = new System.Windows.Forms.Button();
this.comboBoxCelectorMap1 = new System.Windows.Forms.ComboBox(); this.ButtonRemoveJet = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.pictureBoxJet = new System.Windows.Forms.PictureBox(); this.pictureBoxJet = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxJet)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxJet)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// buttonDown1
//
this.buttonDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown1.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
this.buttonDown1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown1.Location = new System.Drawing.Point(68, 899);
this.buttonDown1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonDown1.Name = "buttonDown1";
this.buttonDown1.Size = new System.Drawing.Size(35, 30);
this.buttonDown1.TabIndex = 7;
this.buttonDown1.UseVisualStyleBackColor = true;
//
// groupBox1 // groupBox1
// //
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.buttonRight);
this.groupBox1.Controls.Add(this.buttonLeft);
this.groupBox1.Controls.Add(this.buttonUp);
this.groupBox1.Controls.Add(this.buttonDown);
this.groupBox1.Controls.Add(this.buttonRight1);
this.groupBox1.Controls.Add(this.buttonLeft1);
this.groupBox1.Controls.Add(this.buttonUp1);
this.groupBox1.Controls.Add(this.buttonDown1);
this.groupBox1.Controls.Add(this.ButtonShowOnMap); this.groupBox1.Controls.Add(this.ButtonShowOnMap);
this.groupBox1.Controls.Add(this.ButtonShowStorage); this.groupBox1.Controls.Add(this.ButtonShowStorage);
this.groupBox1.Controls.Add(this.ButtonRemoveJet);
this.groupBox1.Controls.Add(this.maskedTextBoxPosition); this.groupBox1.Controls.Add(this.maskedTextBoxPosition);
this.groupBox1.Controls.Add(this.ButtonAddJet); this.groupBox1.Controls.Add(this.ButtonAddJet);
this.groupBox1.Controls.Add(this.comboBoxCelectorMap1); this.groupBox1.Controls.Add(this.ButtonRemoveJet);
this.groupBox1.Controls.Add(this.buttonLeft); this.groupBox1.Location = new System.Drawing.Point(893, 12);
this.groupBox1.Controls.Add(this.buttonRight);
this.groupBox1.Controls.Add(this.buttonDown);
this.groupBox1.Controls.Add(this.buttonUp);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBox1.Location = new System.Drawing.Point(680, 0);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(200, 524); this.groupBox1.Size = new System.Drawing.Size(191, 561);
this.groupBox1.TabIndex = 0; this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Инструменты"; this.groupBox1.Text = "Инструменты";
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.buttonAddMap);
this.groupBox2.Controls.Add(this.listBoxMaps);
this.groupBox2.Controls.Add(this.ButtonDeleteMap);
this.groupBox2.Controls.Add(this.textBoxNewMapName);
this.groupBox2.Controls.Add(this.comboBoxSelectorMap);
this.groupBox2.Location = new System.Drawing.Point(12, 22);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(173, 235);
this.groupBox2.TabIndex = 15;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Карты";
//
// buttonAddMap
//
this.buttonAddMap.Location = new System.Drawing.Point(6, 85);
this.buttonAddMap.Name = "buttonAddMap";
this.buttonAddMap.Size = new System.Drawing.Size(161, 23);
this.buttonAddMap.TabIndex = 9;
this.buttonAddMap.Text = "Добавить карту";
this.buttonAddMap.UseVisualStyleBackColor = true;
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
//
// listBoxMaps
//
this.listBoxMaps.FormattingEnabled = true;
this.listBoxMaps.ItemHeight = 15;
this.listBoxMaps.Location = new System.Drawing.Point(6, 115);
this.listBoxMaps.Name = "listBoxMaps";
this.listBoxMaps.Size = new System.Drawing.Size(161, 79);
this.listBoxMaps.TabIndex = 8;
this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged);
//
// ButtonDeleteMap
//
this.ButtonDeleteMap.Location = new System.Drawing.Point(6, 200);
this.ButtonDeleteMap.Name = "ButtonDeleteMap";
this.ButtonDeleteMap.Size = new System.Drawing.Size(161, 23);
this.ButtonDeleteMap.TabIndex = 7;
this.ButtonDeleteMap.Text = "Удалить карту";
this.ButtonDeleteMap.UseVisualStyleBackColor = true;
this.ButtonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(6, 51);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(161, 23);
this.textBoxNewMapName.TabIndex = 6;
//
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 22);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(161, 23);
this.comboBoxSelectorMap.TabIndex = 5;
//
// buttonRight
//
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(116, 509);
this.buttonRight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(35, 30);
this.buttonRight.TabIndex = 14;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonLeft
//
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(34, 509);
this.buttonLeft.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(35, 30);
this.buttonLeft.TabIndex = 13;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonUp
//
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(75, 475);
this.buttonUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(35, 30);
this.buttonUp.TabIndex = 12;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(75, 509);
this.buttonDown.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(35, 30);
this.buttonDown.TabIndex = 11;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonRight1
//
this.buttonRight1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight1.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
this.buttonRight1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight1.Location = new System.Drawing.Point(109, 899);
this.buttonRight1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonRight1.Name = "buttonRight1";
this.buttonRight1.Size = new System.Drawing.Size(35, 30);
this.buttonRight1.TabIndex = 10;
this.buttonRight1.UseVisualStyleBackColor = true;
//
// buttonLeft1
//
this.buttonLeft1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft1.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
this.buttonLeft1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft1.Location = new System.Drawing.Point(27, 899);
this.buttonLeft1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonLeft1.Name = "buttonLeft1";
this.buttonLeft1.Size = new System.Drawing.Size(35, 30);
this.buttonLeft1.TabIndex = 9;
this.buttonLeft1.UseVisualStyleBackColor = true;
//
// buttonUp1
//
this.buttonUp1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp1.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
this.buttonUp1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp1.Location = new System.Drawing.Point(68, 865);
this.buttonUp1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonUp1.Name = "buttonUp1";
this.buttonUp1.Size = new System.Drawing.Size(35, 30);
this.buttonUp1.TabIndex = 8;
this.buttonUp1.UseVisualStyleBackColor = true;
//
// ButtonShowOnMap // ButtonShowOnMap
// //
this.ButtonShowOnMap.Location = new System.Drawing.Point(6, 276); this.ButtonShowOnMap.Location = new System.Drawing.Point(17, 418);
this.ButtonShowOnMap.Name = "ButtonShowOnMap"; this.ButtonShowOnMap.Name = "ButtonShowOnMap";
this.ButtonShowOnMap.Size = new System.Drawing.Size(182, 23); this.ButtonShowOnMap.Size = new System.Drawing.Size(161, 23);
this.ButtonShowOnMap.TabIndex = 15; this.ButtonShowOnMap.TabIndex = 6;
this.ButtonShowOnMap.Text = "Посмотреть карту"; this.ButtonShowOnMap.Text = "Посмотреть карту";
this.ButtonShowOnMap.UseVisualStyleBackColor = true; this.ButtonShowOnMap.UseVisualStyleBackColor = true;
this.ButtonShowOnMap.Click += new System.EventHandler(this.ButtonShowOnMap_Click); this.ButtonShowOnMap.Click += new System.EventHandler(this.ButtonShowOnMap_Click);
// //
// ButtonShowStorage // ButtonShowStorage
// //
this.ButtonShowStorage.Location = new System.Drawing.Point(6, 223); this.ButtonShowStorage.Location = new System.Drawing.Point(17, 380);
this.ButtonShowStorage.Name = "ButtonShowStorage"; this.ButtonShowStorage.Name = "ButtonShowStorage";
this.ButtonShowStorage.Size = new System.Drawing.Size(182, 23); this.ButtonShowStorage.Size = new System.Drawing.Size(161, 23);
this.ButtonShowStorage.TabIndex = 14; this.ButtonShowStorage.TabIndex = 3;
this.ButtonShowStorage.Text = "Посмотреть хранилище"; this.ButtonShowStorage.Text = "Посмотреть хранилище";
this.ButtonShowStorage.UseVisualStyleBackColor = true; this.ButtonShowStorage.UseVisualStyleBackColor = true;
this.ButtonShowStorage.Click += new System.EventHandler(this.ButtonShowStorage_Click); this.ButtonShowStorage.Click += new System.EventHandler(this.ButtonShowStorage_Click);
// //
// ButtonRemoveJet
//
this.ButtonRemoveJet.Location = new System.Drawing.Point(6, 144);
this.ButtonRemoveJet.Name = "ButtonRemoveJet";
this.ButtonRemoveJet.Size = new System.Drawing.Size(182, 23);
this.ButtonRemoveJet.TabIndex = 13;
this.ButtonRemoveJet.Text = "Удалить самолет";
this.ButtonRemoveJet.UseVisualStyleBackColor = true;
this.ButtonRemoveJet.Click += new System.EventHandler(this.ButtonRemoveJet_Click);
//
// maskedTextBoxPosition // maskedTextBoxPosition
// //
this.maskedTextBoxPosition.Location = new System.Drawing.Point(6, 115); this.maskedTextBoxPosition.Location = new System.Drawing.Point(17, 301);
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition"; this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
this.maskedTextBoxPosition.Size = new System.Drawing.Size(182, 23); this.maskedTextBoxPosition.Size = new System.Drawing.Size(161, 23);
this.maskedTextBoxPosition.TabIndex = 12; this.maskedTextBoxPosition.TabIndex = 4;
// //
// ButtonAddJet // ButtonAddJet
// //
this.ButtonAddJet.Location = new System.Drawing.Point(6, 68); this.ButtonAddJet.Location = new System.Drawing.Point(17, 263);
this.ButtonAddJet.Name = "ButtonAddJet"; this.ButtonAddJet.Name = "ButtonAddJet";
this.ButtonAddJet.Size = new System.Drawing.Size(182, 23); this.ButtonAddJet.Size = new System.Drawing.Size(161, 23);
this.ButtonAddJet.TabIndex = 11; this.ButtonAddJet.TabIndex = 0;
this.ButtonAddJet.Text = "Добавить самолет"; this.ButtonAddJet.Text = "Добавить самолет";
this.ButtonAddJet.UseVisualStyleBackColor = true; this.ButtonAddJet.UseVisualStyleBackColor = true;
this.ButtonAddJet.Click += new System.EventHandler(this.ButtonAddJet_Click); this.ButtonAddJet.Click += new System.EventHandler(this.ButtonAddJet_Click);
// //
// comboBoxCelectorMap1 // ButtonRemoveJet
// //
this.comboBoxCelectorMap1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.ButtonRemoveJet.Location = new System.Drawing.Point(17, 339);
this.comboBoxCelectorMap1.FormattingEnabled = true; this.ButtonRemoveJet.Name = "ButtonRemoveJet";
this.comboBoxCelectorMap1.Items.AddRange(new object[] { this.ButtonRemoveJet.Size = new System.Drawing.Size(161, 23);
"Простоя карта", this.ButtonRemoveJet.TabIndex = 1;
"Небо"}); this.ButtonRemoveJet.Text = "Удалить самолет";
this.comboBoxCelectorMap1.Location = new System.Drawing.Point(6, 22); this.ButtonRemoveJet.UseVisualStyleBackColor = true;
this.comboBoxCelectorMap1.Name = "comboBoxCelectorMap1"; this.ButtonRemoveJet.Click += new System.EventHandler(this.ButtonRemoveJet_Click);
this.comboBoxCelectorMap1.Size = new System.Drawing.Size(182, 23);
this.comboBoxCelectorMap1.TabIndex = 10;
this.comboBoxCelectorMap1.SelectedIndexChanged += new System.EventHandler(this.comboBoxCelectorMap1_SelectedIndexChanged);
//
// buttonLeft
//
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonLeft.Location = new System.Drawing.Point(51, 467);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(35, 30);
this.buttonLeft.TabIndex = 9;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonRight
//
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonRight.Location = new System.Drawing.Point(133, 467);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(35, 30);
this.buttonRight.TabIndex = 8;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonDown.Location = new System.Drawing.Point(92, 467);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(35, 30);
this.buttonDown.TabIndex = 7;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonUp
//
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonUp.Location = new System.Drawing.Point(92, 431);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(35, 30);
this.buttonUp.TabIndex = 4;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
// //
// pictureBoxJet // pictureBoxJet
// //
this.pictureBoxJet.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBoxJet.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBoxJet.Location = new System.Drawing.Point(0, 0); this.pictureBoxJet.Location = new System.Drawing.Point(0, 0);
this.pictureBoxJet.Name = "pictureBoxJet"; this.pictureBoxJet.Name = "pictureBoxJet";
this.pictureBoxJet.Size = new System.Drawing.Size(680, 524); this.pictureBoxJet.Size = new System.Drawing.Size(887, 573);
this.pictureBoxJet.TabIndex = 1; this.pictureBoxJet.TabIndex = 6;
this.pictureBoxJet.TabStop = false; this.pictureBoxJet.TabStop = false;
// //
// FormMapWithSetJets // FormMapWithSetJets
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(880, 524); this.ClientSize = new System.Drawing.Size(1096, 573);
this.Controls.Add(this.pictureBoxJet);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.pictureBoxJet);
this.Name = "FormMapWithSetJets"; this.Name = "FormMapWithSetJets";
this.Text = "Карта с набором объектов"; this.Text = "Карта с набором объектов";
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxJet)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxJet)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -199,17 +317,26 @@
#endregion #endregion
private Button buttonDown1;
private GroupBox groupBox1; private GroupBox groupBox1;
private PictureBox pictureBoxJet; private Button buttonRight1;
private Button buttonUp; private Button buttonLeft1;
private Button buttonDown; private Button buttonUp1;
private Button buttonRight;
private Button buttonLeft;
private Button ButtonShowOnMap; private Button ButtonShowOnMap;
private ComboBox comboBoxSelectorMap;
private Button ButtonShowStorage; private Button ButtonShowStorage;
private Button ButtonRemoveJet;
private TextBox maskedTextBoxPosition; private TextBox maskedTextBoxPosition;
private Button ButtonAddJet; private Button ButtonAddJet;
private ComboBox comboBoxCelectorMap1; private Button ButtonRemoveJet;
private PictureBox pictureBoxJet;
private Button buttonRight;
private Button buttonLeft;
private Button buttonUp;
private Button buttonDown;
private GroupBox groupBox2;
private Button buttonAddMap;
private ListBox listBoxMaps;
private Button ButtonDeleteMap;
private TextBox textBoxNewMapName;
} }
} }

View File

@ -13,41 +13,102 @@ namespace AirBomber
{ {
public partial class FormMapWithSetJets : Form public partial class FormMapWithSetJets : Form
{ {
/// <summary>
/// Словарь для выпадающего списка
/// </summary>
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
{
{ "Простая карта", new SimpleMap() },
{ "Небо", new SkyMap() }
};
/// <summary>
/// Объект от коллекции карт
/// </summary>
private readonly MapsCollection _mapsCollection;
/// <summary> /// <summary>
/// Объект от класса карты с набором объектов /// Объект от класса карты с набором объектов
/// </summary> /// </summary>
private MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap> _mapJetsCollectionGeneric; private MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap> _mapJetsCollectionGeneric;
/// <summary> /// <summary>
/// Конструктор /// Конструктор
/// </summary> /// </summary>
public FormMapWithSetJets() public FormMapWithSetJets()
{ {
InitializeComponent(); InitializeComponent();
_mapsCollection = new MapsCollection(pictureBoxJet.Width, pictureBoxJet.Height);
comboBoxSelectorMap.Items.Clear();
foreach (var elem in _mapsDict)
{
comboBoxSelectorMap.Items.Add(elem.Key);
}
}
/// <summary>
/// Заполнение listBoxMaps
/// </summary>
private void ReloadMaps()
{
int index = listBoxMaps.SelectedIndex;
listBoxMaps.Items.Clear();
for (int i = 0; i < _mapsCollection.Keys.Count; i++)
{
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
}
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
{
listBoxMaps.SelectedIndex = 0;
}
else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count)
{
listBoxMaps.SelectedIndex = index;
}
}
/// <summary>
/// Добавление карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonAddMap_Click(object sender, EventArgs e)
{
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
{
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
ReloadMaps();
} }
/// <summary> /// <summary>
/// Выбор карты /// Выбор карты
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void comboBoxCelectorMap1_SelectedIndexChanged(object sender, EventArgs e) private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
{ {
AbstractMap map = null; pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
switch (comboBoxCelectorMap1.Text)
{
case "Простая карта":
map = new SimpleMap();
break;
case "Небо":
map = new SkyMap();
break;
} }
if (map != null) /// <summary>
/// Удаление карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonDeleteMap_Click(object sender, EventArgs e)
{ {
_mapJetsCollectionGeneric = new MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap>(pictureBoxJet.Width, pictureBoxJet.Height, map); if (listBoxMaps.SelectedIndex == -1)
{
return;
} }
else if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{ {
_mapJetsCollectionGeneric = null; _mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
ReloadMaps();
} }
} }
/// <summary> /// <summary>
@ -57,7 +118,7 @@ namespace AirBomber
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonAddJet_Click(object sender, EventArgs e) private void ButtonAddJet_Click(object sender, EventArgs e)
{ {
if (_mapJetsCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }
@ -69,11 +130,11 @@ namespace AirBomber
MessageBox.Show("Сначала создайте объект"); MessageBox.Show("Сначала создайте объект");
return; return;
} }
DrawningObjectJet bus = new(form.SelectedJet); DrawningObjectJet jet = new(form.SelectedJet);
if (_mapJetsCollectionGeneric + bus != -1) if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + jet != -1)
{ {
MessageBox.Show("Объект добавлен"); MessageBox.Show("Объект добавлен");
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowSet(); pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
} }
else else
{ {
@ -88,6 +149,12 @@ namespace AirBomber
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonRemoveJet_Click(object sender, EventArgs e) private void ButtonRemoveJet_Click(object sender, EventArgs e)
{ {
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text)) if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
{ {
return; return;
@ -97,10 +164,10 @@ namespace AirBomber
return; return;
} }
int pos = Convert.ToInt32(maskedTextBoxPosition.Text); int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
if (_mapJetsCollectionGeneric - pos != null) if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
{ {
MessageBox.Show("Объект удален"); MessageBox.Show("Объект удален");
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowSet(); pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
} }
else else
{ {
@ -114,11 +181,11 @@ namespace AirBomber
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonShowStorage_Click(object sender, EventArgs e) private void ButtonShowStorage_Click(object sender, EventArgs e)
{ {
if (_mapJetsCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowSet(); pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
} }
/// <summary> /// <summary>
/// Вывод карты /// Вывод карты
@ -127,15 +194,20 @@ namespace AirBomber
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonShowOnMap_Click(object sender, EventArgs e) private void ButtonShowOnMap_Click(object sender, EventArgs e)
{ {
if (_mapJetsCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowOnMap(); pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
} }
/// <summary>
/// Перемещение
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonMove_Click(object sender, EventArgs e) private void ButtonMove_Click(object sender, EventArgs e)
{ {
if (_mapJetsCollectionGeneric == null) if (listBoxMaps.SelectedIndex == -1)
{ {
return; return;
} }
@ -157,7 +229,7 @@ namespace AirBomber
dir = Direction.Right; dir = Direction.Right;
break; break;
} }
pictureBoxJet.Image = _mapJetsCollectionGeneric.MoveObject(dir); pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
} }
} }
} }