Исправление ошибок
This commit is contained in:
parent
ae022205eb
commit
bdf0062316
@ -5,26 +5,27 @@ namespace SailBoat
|
||||
{
|
||||
public partial class FormSailBoat : Form
|
||||
{
|
||||
private DrawningSailBoat _drawningSailBoat;
|
||||
private DrawningBoat? _drawningBoat;
|
||||
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
public FormSailBoat()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningBoat == null) { return; }
|
||||
Bitmap bmp = new(pictureBoxSailBoat.Width, pictureBoxSailBoat.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningBoat.DrawTransport(gr);
|
||||
pictureBoxSailBoat.Image = bmp;
|
||||
|
||||
}
|
||||
|
||||
private void buttonCreateSailBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningSailBoat = new DrawningSailBoat();
|
||||
_drawningSailBoat.Init(random.Next(300, 700), random.Next(2000, 4000), Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)), Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxSailBoat.Width, pictureBoxSailBoat.Height);
|
||||
_drawningSailBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_drawningBoat = new DrawningSailBoat(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)), pictureBoxSailBoat.Width, pictureBoxSailBoat.Height);
|
||||
_drawningBoat.SetPosition(random.Next(10, 100), random.Next(10,100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user