Compare commits

..

6 Commits

3 changed files with 19 additions and 12 deletions

View File

@ -84,14 +84,15 @@ namespace Artilleries
g.FillRectangle(brush, _startPosX + _artilleryWidth / 8 * 2, _startPosY, _artilleryWidth / 8 * 4, _artilleryWidth / 5); g.FillRectangle(brush, _startPosX + _artilleryWidth / 8 * 2, _startPosY, _artilleryWidth / 8 * 4, _artilleryWidth / 5);
g.FillRectangle(brush, _startPosX, _startPosY + _artilleryHeight / 5, _artilleryWidth, _artilleryHeight / 3); g.FillRectangle(brush, _startPosX, _startPosY + _artilleryHeight / 5, _artilleryWidth, _artilleryHeight / 3);
Pen blackPen = new(Color.Black); Brush blackBrush = new SolidBrush(Color.Black);
g.DrawEllipse(blackPen, _startPosX, _startPosY + _artilleryHeight * 2 / 5, _artilleryWidth, _artilleryHeight * 2 / 5); Brush grayBrush = new SolidBrush(Color.Gray);
g.DrawEllipse(blackPen, _startPosX + _artilleryWidth / 20, _startPosY + _artilleryHeight * 7 / 15, _artilleryWidth * 4 / 20, _artilleryHeight * 10 / 32); g.FillEllipse(grayBrush, _startPosX, _startPosY + _artilleryHeight * 2 / 5, _artilleryWidth, _artilleryHeight * 2 / 5);
g.DrawEllipse(blackPen, _startPosX + _artilleryWidth * 5 / 20, _startPosY + _artilleryHeight * 9 / 16, _artilleryWidth * 3 / 20, _artilleryHeight * 8 / 32); g.FillEllipse(blackBrush, _startPosX + _artilleryWidth / 20, _startPosY + _artilleryHeight * 7 / 15, _artilleryWidth * 4 / 20, _artilleryHeight * 10 / 32);
g.DrawEllipse(blackPen, _startPosX + _artilleryWidth * 8 / 20, _startPosY + _artilleryHeight * 10 / 16, _artilleryWidth * 2 / 20, _artilleryHeight * 6 / 32); g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 5 / 20, _startPosY + _artilleryHeight * 9 / 16, _artilleryWidth * 3 / 20, _artilleryHeight * 8 / 32);
g.DrawEllipse(blackPen, _startPosX + _artilleryWidth * 10 / 20, _startPosY + _artilleryHeight * 10 / 16, _artilleryWidth * 2 / 20, _artilleryHeight * 6 / 32); g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 8 / 20, _startPosY + _artilleryHeight * 10 / 16, _artilleryWidth * 2 / 20, _artilleryHeight * 6 / 32);
g.DrawEllipse(blackPen, _startPosX + _artilleryWidth * 12 / 20, _startPosY + _artilleryHeight * 9 / 16, _artilleryWidth * 3 / 20, _artilleryHeight * 8 / 32); g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 10 / 20, _startPosY + _artilleryHeight * 10 / 16, _artilleryWidth * 2 / 20, _artilleryHeight * 6 / 32);
g.DrawEllipse(blackPen, _startPosX + _artilleryWidth * 15 / 20, _startPosY + _artilleryHeight * 7 / 15, _artilleryWidth * 4 / 20, _artilleryHeight * 10 / 32); g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 12 / 20, _startPosY + _artilleryHeight * 9 / 16, _artilleryWidth * 3 / 20, _artilleryHeight * 8 / 32);
g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 15 / 20, _startPosY + _artilleryHeight * 7 / 15, _artilleryWidth * 4 / 20, _artilleryHeight * 10 / 32);
} }
public void ChangeBorders(int width, int height) public void ChangeBorders(int width, int height)

View File

@ -86,6 +86,7 @@
this.pictureBoxArtilleries.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBoxArtilleries.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBoxArtilleries.TabIndex = 1; this.pictureBoxArtilleries.TabIndex = 1;
this.pictureBoxArtilleries.TabStop = false; this.pictureBoxArtilleries.TabStop = false;
this.pictureBoxArtilleries.SizeChanged += new System.EventHandler(this.pictureBoxArtilleries_Resize);
// //
// buttonCreate // buttonCreate
// //
@ -100,6 +101,7 @@
// //
// buttonLeft // buttonLeft
// //
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowLeft; this.buttonLeft.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowLeft;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(509, 375); this.buttonLeft.Location = new System.Drawing.Point(509, 375);
@ -111,6 +113,7 @@
// //
// buttonUp // buttonUp
// //
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowUp; this.buttonUp.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowUp;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(543, 342); this.buttonUp.Location = new System.Drawing.Point(543, 342);
@ -122,6 +125,7 @@
// //
// buttonDown // buttonDown
// //
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowDown; this.buttonDown.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowDown;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(543, 375); this.buttonDown.Location = new System.Drawing.Point(543, 375);
@ -133,6 +137,7 @@
// //
// buttonRight // buttonRight
// //
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowRight; this.buttonRight.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowRight;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(579, 375); this.buttonRight.Location = new System.Drawing.Point(579, 375);

View File

@ -8,6 +8,7 @@ namespace Artilleries
{ {
InitializeComponent(); InitializeComponent();
} }
private void Draw() private void Draw()
{ {
Bitmap bmp = new(pictureBoxArtilleries.Width, pictureBoxArtilleries.Height); Bitmap bmp = new(pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
@ -21,10 +22,10 @@ namespace Artilleries
Random rnd = new(); Random rnd = new();
_artillery = new DrawingArtillery(); _artillery = new DrawingArtillery();
_artillery.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _artillery.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_artillery.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxArtilleries.Width, pictureBoxArtilleries.Height); _artillery.SetPosition(rnd.Next(pictureBoxArtilleries.Width - 161, pictureBoxArtilleries.Width - 81), rnd.Next(10, 100), pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
SpeedStatusLabel.Text = $"Ñêîðîñòü: {_artillery.Artillery.Speed}"; SpeedStatusLabel.Text = $"Скорость: {_artillery.Artillery.Speed}";
WeightStatusLabel.Text = $"Âåñ: {_artillery.Artillery.Weight}"; WeightStatusLabel.Text = $"Вес: {_artillery.Artillery.Weight}";
ColorStatusLabel.Text = $"Öâåò: {_artillery.Artillery.BodyColor.Name}"; ColorStatusLabel.Text = $"Цвет: {_artillery.Artillery.BodyColor.Name}";
Draw(); Draw();
} }