Пятая лабораторная работа
This commit is contained in:
parent
0aa8af6b66
commit
2a6c6e17e6
@ -11,7 +11,7 @@ namespace MotorBoat
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public float Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color BodyColor { get; set; }
|
||||
public float Step => Speed * 100 / Weight;
|
||||
public EntityBoat(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
|
20
MotorBoat/MotorBoat/FormBoatConfig.Designer.cs
generated
20
MotorBoat/MotorBoat/FormBoatConfig.Designer.cs
generated
@ -52,7 +52,7 @@
|
||||
this.LabelDopColor = new System.Windows.Forms.Label();
|
||||
this.LabelBaseColor = new System.Windows.Forms.Label();
|
||||
this.buttonOk = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||
@ -349,21 +349,21 @@
|
||||
this.buttonOk.UseVisualStyleBackColor = true;
|
||||
this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
|
||||
//
|
||||
// button2
|
||||
// buttonCancel
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(674, 190);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 12;
|
||||
this.button2.Text = "Отмена";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Location = new System.Drawing.Point(674, 190);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 12;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormBoatConfig
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(783, 221);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOk);
|
||||
this.Controls.Add(this.panelobject);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
@ -405,7 +405,7 @@
|
||||
private Label LabelDopColor;
|
||||
private Label LabelBaseColor;
|
||||
private Button buttonOk;
|
||||
private Button button2;
|
||||
private Button buttonCancel;
|
||||
private CheckBox checkBoxBackside;
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ namespace MotorBoat
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
buttonCancel.Click += (s, a) => Close();
|
||||
}
|
||||
|
||||
public void AddEvent(BoatDelegate ev)
|
||||
@ -98,13 +99,17 @@ namespace MotorBoat
|
||||
|
||||
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
_boat.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
DrawBoat();
|
||||
if (_boat != null)
|
||||
{
|
||||
_boat.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
DrawBoat();
|
||||
}
|
||||
else return;
|
||||
}
|
||||
|
||||
private void LabelDopColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if(_boat is not DrawningMotorBoat MotorBoat)
|
||||
if(_boat is not DrawningMotorBoat MotorBoat || _boat==null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -111,12 +111,12 @@ namespace MotorBoat
|
||||
|
||||
if (_mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectBoat(boat) != -1)
|
||||
{
|
||||
MessageBox.Show("Object is added");
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Unable to add object");
|
||||
MessageBox.Show("Не удалось добавить");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user