DozorovaA.A_FirstLabWork #1

Merged
eegov merged 2 commits from FirstLabWork into master 2022-09-30 10:48:50 +04:00
4 changed files with 31 additions and 15 deletions
Showing only changes of commit 61f59ee3be - Show all commits

View File

@ -13,11 +13,11 @@ namespace ArmoredVehicle
/// </summary>
public ArmoredVehicleEntity ArmoredVehicle { get; private set; }
/// <summary>
/// Левая координата отрисовки корабля
/// Левая координата отрисовки
/// </summary>
private float _startPosX;
/// <summary>
/// Верхняя кооридната отрисовки корабля
/// Верхняя кооридната отрисовки
/// </summary>
private float _startPosY;
/// <summary>
@ -62,7 +62,7 @@ namespace ArmoredVehicle
}
else
{
_startPosX = _ArmoredVehicleWidth;
_startPosX = 0;
}
if(y > 0 && y < height)
@ -71,11 +71,17 @@ namespace ArmoredVehicle
}
else
{
_startPosY = _ArmoredVehicleHeight;
_startPosY = 0;
}
_pictureWidth = width;
_pictureHeight = height;
if(width >= _ArmoredVehicleWidth && height >= _ArmoredVehicleHeight)
{
_pictureWidth = width;
_pictureHeight = height;
}
}
/// <summary>
/// Изменение направления пермещения

View File

@ -156,6 +156,7 @@
this.Controls.Add(this.CreateButton);
this.Controls.Add(this.DrawingPictureBox);
this.Controls.Add(this.statusStrip);
this.MinimumSize = new System.Drawing.Size(210, 50);
this.Name = "MainForm";
this.Text = "Военная машина";
((System.ComponentModel.ISupportInitialize)(this.DrawingPictureBox)).EndInit();

View File

@ -6,16 +6,25 @@ namespace ArmoredVehicle
public MainForm()
{
InitializeComponent();
//this.MinimumSize = new System.Drawing.Size(300, 250);
}
/// <summary>
/// Ìåòîä ïðîðèñîâêè ìàøèíû
/// </summary>
private void Draw()
{
Bitmap bmp = new(DrawingPictureBox.Width, DrawingPictureBox.Height);
Graphics gr = Graphics.FromImage(bmp);
_ArmoredVehicle?.DrawTransport(gr);
DrawingPictureBox.Image = bmp;
try
{
Bitmap bmp = new(DrawingPictureBox.Width, DrawingPictureBox.Height);
Graphics gr = Graphics.FromImage(bmp);
_ArmoredVehicle?.DrawTransport(gr);
DrawingPictureBox.Image = bmp;
}
catch
{
MessageBox.Show("Íåêîððåêòíå ðàçìåðû îêíà!");
}
}
/// <summary>
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü"
@ -27,7 +36,7 @@ namespace ArmoredVehicle
Random rnd = new();
_ArmoredVehicle = new DrawingArmoredVehicle();
_ArmoredVehicle.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_ArmoredVehicle.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), DrawingPictureBox.Width, DrawingPictureBox.Height);
_ArmoredVehicle.SetPosition(/*rnd.Next(0, 100)*/ -10, rnd.Next(0, 100), DrawingPictureBox.Width, DrawingPictureBox.Height);
Review

Закомментированного кода быть не должно

Закомментированного кода быть не должно
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_ArmoredVehicle.ArmoredVehicle.Speed}";
toolStripStatusLabelWeight.Text = $"Âåñ: {_ArmoredVehicle.ArmoredVehicle.Weight}";
toolStripStatusLabelColor.Text = $"Öâåò: {_ArmoredVehicle.ArmoredVehicle.BodyColor.Name}";

View File

@ -61,7 +61,7 @@
<data name="ButtonDown.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAABkAAAAZACAIAAACubhnwAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAy5RJREFUeF7s/emTZGd54O/3L9eqbkkI1GKxkUHsCA8gsXhACBNsxoBsY2BYhIkY
vwAADr8BOAVTJAAAy5RJREFUeF7s/emTZGd54O/3L9eqbkkI1GKxkUHsCA8gsXhACBNsxoBsY2BYhIkY
ApgAIeMxYRADg74QNjJbBMYwrIPD0oBZBHjAbGYkbGMW4wn+GI/VXZVL+XdX3tmHstDSLVU/dVfmdb04
8WTptfq583Oec/LIvwFAbV/+8pf/fwDU0+v1cnHkyJG4vu1tb1v+ww0A+03AAqA6AQugJgELgGYELACq
E7AAahKwAGhGwAKgOgELoCYBC4BmBCwAqhOwAGoSsABoRsACoDoBC6AmAQuAZgQsAKoTsABqErAAaEbA
@ -936,7 +936,7 @@
<data name="ButtonRight.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAABkAAAAZACAIAAACubhnwAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAtnhJREFUeF7s3fmbZXdVL/7NHs6p6m4ydRIvQwgJiQgSCJDwRUaVYICAPqjhEmVw
vwAADr8BOAVTJAAAtnhJREFUeF7s3fmbZXdVL/7NHs6p6m4ydRIvQwgJiQgSCJDwRUaVYICAPqjhEmVw
iAo3xAjKKBBl8MEQUO5FgSBwITIJ6FUMgyZBCSjivX9O0nXG+q7aq2p7aELS6VTX2afq9frh86z92QdI
uqvO4367PmsXmwAAAADQYwIsAAAAAHpNgAUAAABArwmwAAAAAOg1ARYAAAAAvSbAAgAAAKDXBFgAAAAA
9JoACwAAAIBeE2ABAAAA0GsCLAAAAAB6TYAFAAAAQK8JsAAAAADoNQEWAAAAAL0mwAIAAACg1wRYAAAA
@ -1721,7 +1721,7 @@
<data name="ButtonLeft.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAABkAAAAZACAIAAACubhnwAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAt0tJREFUeF7s3fmXbHdZL/7qGvucEwicDBgkEIYwKCEB4mJIIiKwkEEGXQHBCA5c
vwAADr8BOAVTJAAAt0tJREFUeF7s3fmXbHdZL/7qGvucEwicDBgkEIYwKCEB4mJIIiKwkEEGXQHBCA5c
hst0EQ34lcGrQBACsq5BJhUvYYoQVCZRQlBALsa77h9z17rprtq7Nt+n9lO9LUJCzsnp7r2r6/X64bOe
/al2mdNdVWvtN8/n2b0fAgAAAECHCbAAAAAA6DQBFgAAAACdJsACAAAAoNMEWAAAAAB0mgALAAAAgE4T
YAEAAADQaQIsAAAAADpNgAUAAABApwmwAAAAAOg0ARYAAAAAnSbAAgAAAKDTBFgAAAAAdJoACwAAAIBO
@ -2509,7 +2509,7 @@
<data name="ButtonUp.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAABkAAAAZACAIAAACubhnwAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wAAADsABataJCQAAy01JREFUeF7s3fm/ZFV5L/7TVbWr6nTTjM0QBUQhikMEgsQBiYYEoqJGo8YxJlGD
vwAADr8BOAVTJAAAy01JREFUeF7s3fm/ZFV5L/7TVbWr6nTTjM0QBUQhikMEgsQBiYYEoqJGo8YxJlGD
XxViNIng1WBiDEQxwRgvDhiNosYB472KQyBgohLuNa/c1/1fbuxTs9/n7Kd6WSLQ0+lzani/f1ivtTcK
3edU7f2sz15r7bUfAwAAAMAcE2ABAAAAMNcEWAAAAADMNQEWAAAAAHNNgAUAAADAXBNgAQAAADDXBFgA
AAAAzDUBFgAAAABzTYAFAAAAwFwTYAEAAAAw1wRYAAAAAMw1ARYAAAAAc02ABQAAAMBcE2ABAAAAMNcE