esd
This commit is contained in:
parent
c982fa4daf
commit
c21716e044
31
ProjectBus/ProjectBus/FormBoat.Designer.cs
generated
31
ProjectBus/ProjectBus/FormBoat.Designer.cs
generated
@ -30,13 +30,11 @@
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBoat));
|
||||
pictureBoxBoat = new PictureBox();
|
||||
button1 = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
buttonLeft = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonCretaeBoat = new Button();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxBoat).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -53,18 +51,6 @@
|
||||
pictureBoxBoat.TabStop = false;
|
||||
pictureBoxBoat.Click += pictureBoxBoat_Click;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
button1.Location = new Point(10, 307);
|
||||
button1.Margin = new Padding(3, 2, 3, 2);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(186, 22);
|
||||
button1.TabIndex = 1;
|
||||
button1.Text = "создать катер";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
button1.Click += ButtonCreateBoat_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
@ -129,18 +115,6 @@
|
||||
comboBoxStrategy.Size = new Size(133, 23);
|
||||
comboBoxStrategy.TabIndex = 6;
|
||||
//
|
||||
// buttonCretaeBoat
|
||||
//
|
||||
buttonCretaeBoat.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCretaeBoat.Location = new Point(210, 308);
|
||||
buttonCretaeBoat.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCretaeBoat.Name = "buttonCretaeBoat";
|
||||
buttonCretaeBoat.Size = new Size(186, 22);
|
||||
buttonCretaeBoat.TabIndex = 7;
|
||||
buttonCretaeBoat.Text = "создать лодку";
|
||||
buttonCretaeBoat.UseVisualStyleBackColor = true;
|
||||
buttonCretaeBoat.Click += buttonCretaeBoat_Click;
|
||||
//
|
||||
// buttonStrategyStep
|
||||
//
|
||||
buttonStrategyStep.Location = new Point(607, 34);
|
||||
@ -158,18 +132,15 @@
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(700, 338);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(buttonCretaeBoat);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(pictureBoxBoat);
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormBoat";
|
||||
Text = "FormBoat";
|
||||
Load += FormBoat_Load;
|
||||
Click += ButtonMove_Click;
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxBoat).EndInit();
|
||||
ResumeLayout(false);
|
||||
@ -179,13 +150,11 @@
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxBoat;
|
||||
private Button button1;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private Button buttonLeft;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonCretaeBoat;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
}
|
@ -37,57 +37,6 @@ namespace ProjectBoat
|
||||
pictureBoxBoat.Image = bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта класса-перемещения
|
||||
/// </summary>
|
||||
/// <param name="type">Тип создаваемого объекта</param>
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
Random random = new();
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningBoat):
|
||||
_drawningBoat = new DrawningBoat(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256),
|
||||
random.Next(0, 256), random.Next(0, 256)));
|
||||
break;
|
||||
case nameof(DrawningMBoat):
|
||||
_drawningBoat = new DrawningMBoat(random.Next(100,
|
||||
300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256),
|
||||
random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256),
|
||||
random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
_drawningBoat.SetPictureSize(pictureBoxBoat.Width,
|
||||
pictureBoxBoat.Height);
|
||||
_drawningBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_strategy = null;
|
||||
comboBoxStrategy.Enabled = true;
|
||||
Draw();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать военный крейсер"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCreateBoat_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningMBoat));
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать крейсер"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCretaeBoat_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBoat));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||
/// </summary>
|
||||
@ -170,11 +119,6 @@ namespace ProjectBoat
|
||||
}
|
||||
}
|
||||
|
||||
private void FormBoat_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void pictureBoxBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user