diff --git a/LainerForm.Designer.cs b/LainerForm.Designer.cs deleted file mode 100644 index 26fbf24..0000000 --- a/LainerForm.Designer.cs +++ /dev/null @@ -1,188 +0,0 @@ -namespace ProjectLainer -{ - partial class LainerForm : Form - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - pictureBoxLainer = new PictureBox(); - ButtonCreate = new Button(); - buttonRight = new Button(); - buttonLeft = new Button(); - buttonDown = new Button(); - buttonUp = new Button(); - ButtonCreateSuperLainer = new Button(); - comboBoxStrategy = new ComboBox(); - ButtonStep = new Button(); - ButtonSelectLainer = new Button(); - ((System.ComponentModel.ISupportInitialize)pictureBoxLainer).BeginInit(); - SuspendLayout(); - // - // pictureBoxLainer - // - pictureBoxLainer.Dock = DockStyle.Fill; - pictureBoxLainer.Location = new Point(0, 0); - pictureBoxLainer.Name = "pictureBoxLainer"; - pictureBoxLainer.Size = new Size(729, 397); - pictureBoxLainer.SizeMode = PictureBoxSizeMode.AutoSize; - pictureBoxLainer.TabIndex = 0; - pictureBoxLainer.TabStop = false; - // - // ButtonCreate - // - ButtonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - ButtonCreate.Location = new Point(12, 356); - ButtonCreate.Name = "ButtonCreate"; - ButtonCreate.Size = new Size(94, 29); - ButtonCreate.TabIndex = 1; - ButtonCreate.Text = "создать"; - ButtonCreate.UseVisualStyleBackColor = true; - ButtonCreate.Click += ButtonCreate_Click; - // - // buttonRight - // - buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonRight.BackgroundImage = Lainer1.Properties.Resources._3042406; - buttonRight.BackgroundImageLayout = ImageLayout.Zoom; - buttonRight.Location = new Point(659, 315); - buttonRight.Name = "buttonRight"; - buttonRight.Size = new Size(30, 30); - buttonRight.TabIndex = 2; - buttonRight.UseVisualStyleBackColor = true; - buttonRight.Click += ButtonMove_Click; - // - // buttonLeft - // - buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonLeft.BackgroundImage = Lainer1.Properties.Resources._2; - buttonLeft.BackgroundImageLayout = ImageLayout.Zoom; - buttonLeft.Location = new Point(587, 315); - buttonLeft.Name = "buttonLeft"; - buttonLeft.Size = new Size(30, 30); - buttonLeft.TabIndex = 3; - buttonLeft.UseVisualStyleBackColor = true; - buttonLeft.Click += ButtonMove_Click; - // - // buttonDown - // - buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonDown.BackgroundImage = Lainer1.Properties.Resources._1; - buttonDown.BackgroundImageLayout = ImageLayout.Zoom; - buttonDown.Location = new Point(623, 344); - buttonDown.Name = "buttonDown"; - buttonDown.Size = new Size(30, 30); - buttonDown.TabIndex = 4; - buttonDown.UseVisualStyleBackColor = true; - buttonDown.Click += ButtonMove_Click; - // - // buttonUp - // - buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonUp.BackgroundImage = Lainer1.Properties.Resources._3; - buttonUp.BackgroundImageLayout = ImageLayout.Zoom; - buttonUp.Location = new Point(623, 287); - buttonUp.Name = "buttonUp"; - buttonUp.Size = new Size(30, 30); - buttonUp.TabIndex = 5; - buttonUp.UseVisualStyleBackColor = true; - buttonUp.Click += ButtonMove_Click; - // - // ButtonCreateSuperLainer - // - ButtonCreateSuperLainer.Location = new Point(137, 356); - ButtonCreateSuperLainer.Name = "ButtonCreateSuperLainer"; - ButtonCreateSuperLainer.Size = new Size(192, 29); - ButtonCreateSuperLainer.TabIndex = 6; - ButtonCreateSuperLainer.Text = "создать супер лайнер"; - ButtonCreateSuperLainer.UseVisualStyleBackColor = true; - ButtonCreateSuperLainer.Click += ButtonCreateSuperLainer_Click; - // - // comboBoxStrategy - // - comboBoxStrategy.FormattingEnabled = true; - comboBoxStrategy.Items.AddRange(new object[] { "центр", "край" }); - comboBoxStrategy.Location = new Point(566, 12); - comboBoxStrategy.Name = "comboBoxStrategy"; - comboBoxStrategy.Size = new Size(151, 28); - comboBoxStrategy.TabIndex = 7; - // - // ButtonStep - // - ButtonStep.Location = new Point(623, 66); - ButtonStep.Name = "ButtonStep"; - ButtonStep.Size = new Size(94, 29); - ButtonStep.TabIndex = 8; - ButtonStep.Text = "шаг"; - ButtonStep.UseVisualStyleBackColor = true; - ButtonStep.Click += ButtonStep_Click; - // - // ButtonSelectLainer - // - ButtonSelectLainer.Location = new Point(369, 356); - ButtonSelectLainer.Name = "ButtonSelectLainer"; - ButtonSelectLainer.Size = new Size(94, 29); - ButtonSelectLainer.TabIndex = 9; - ButtonSelectLainer.Text = "выбрать"; - ButtonSelectLainer.UseVisualStyleBackColor = true; - ButtonSelectLainer.Click += ButtonSelectLainer_Click; - // - // LainerForm - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(729, 397); - Controls.Add(ButtonSelectLainer); - Controls.Add(ButtonStep); - Controls.Add(comboBoxStrategy); - Controls.Add(ButtonCreateSuperLainer); - Controls.Add(buttonUp); - Controls.Add(buttonDown); - Controls.Add(buttonLeft); - Controls.Add(buttonRight); - Controls.Add(ButtonCreate); - Controls.Add(pictureBoxLainer); - Name = "LainerForm"; - Text = "LainerField"; - ((System.ComponentModel.ISupportInitialize)pictureBoxLainer).EndInit(); - ResumeLayout(false); - PerformLayout(); - } - - - #endregion - - private PictureBox pictureBoxLainer; - private Button ButtonCreate; - private Button buttonRight; - private Button buttonLeft; - private Button buttonDown; - private Button buttonUp; - private Button ButtonCreateSuperLainer; - private ComboBox comboBoxStrategy; - private Button ButtonStep; - private Button ButtonSelectLainer; - } -} \ No newline at end of file diff --git a/LainerForm.cs b/LainerForm.cs deleted file mode 100644 index 1e93d0c..0000000 --- a/LainerForm.cs +++ /dev/null @@ -1,131 +0,0 @@ -using ProjectLainer.DrawningObjects; -using ProjectLainer.MovementStrategy; -namespace ProjectLainer -{ - public partial class LainerForm : Form - { - private DrawingLainer? _drawningLainer; - private AbstractStrategy? _abstractStrategy; - private AbstractStrategy? _strategy; - public DrawingLainer? SelectedLainer { get; private set; } - public LainerForm() - { - InitializeComponent(); - _strategy = null; - SelectedLainer = null; - } - private void Draw() - { - if (_drawningLainer == null) - { - return; - } - Bitmap bmp = new(pictureBoxLainer.Width, - pictureBoxLainer.Height); - Graphics gr = Graphics.FromImage(bmp); - _drawningLainer.DrawTransport(gr); - pictureBoxLainer.Image = bmp; - } - private void ButtonCreateSuperLainer_Click(object sender, EventArgs e) - { - Random random = new(); - Color mainColor = Color.FromArgb(random.Next(0, 256), - random.Next(0, 256), random.Next(0, 256)); - Color additColor = Color.FromArgb(random.Next(0, 256), - random.Next(0, 256), random.Next(0, 256)); - ColorDialog dialog = new(); - if (dialog.ShowDialog() == DialogResult.OK) - { - mainColor = dialog.Color; - } - if (dialog.ShowDialog() == DialogResult.OK) - { - additColor = dialog.Color; - } - _drawningLainer = new DrawningSuperLainer(random.Next(100, 300), - random.Next(1000, 3000), mainColor, additColor, Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), - pictureBoxLainer.Width, pictureBoxLainer.Height); - _drawningLainer.SetPosition(random.Next(10, 100), random.Next(10, 100)); - Draw(); - } - private void ButtonCreate_Click(object sender, EventArgs e) - { - Random random = new(); - Color color = Color.FromArgb(random.Next(0, 256), - random.Next(0, 256), random.Next(0, 256)); - ColorDialog dialog = new(); - if (dialog.ShowDialog() == DialogResult.OK) - { - color = dialog.Color; - } - _drawningLainer = new DrawingLainer(random.Next(100, 300), - random.Next(1000, 3000), color, - pictureBoxLainer.Width, pictureBoxLainer.Height); - _drawningLainer.SetPosition(random.Next(10, 100), random.Next(10, 100)); - Draw(); - } - private void ButtonMove_Click(object sender, EventArgs e) - { - if (_drawningLainer == null) - { - return; - } - string name = ((Button)sender)?.Name ?? string.Empty; - switch (name) - { - case "buttonUp": - _drawningLainer.MoveTransport(DirectionType.Up); - break; - case "buttonDown": - _drawningLainer.MoveTransport(DirectionType.Down); - break; - case "buttonLeft": - _drawningLainer.MoveTransport(DirectionType.Left); - break; - case "buttonRight": - _drawningLainer.MoveTransport(DirectionType.Right); - break; - } - Draw(); - } - private void ButtonStep_Click(object sender, EventArgs e) - { - if (_drawningLainer == null) - { - return; - } - if (comboBoxStrategy.Enabled) - { - _strategy = comboBoxStrategy.SelectedIndex switch - { - 0 => new MoveToCenter(), - 1 => new MoveToBorder(), - _ => null, - }; - if (_strategy == null) - { - return; - } - _strategy.SetData(_drawningLainer.GetMoveableObject, - pictureBoxLainer.Width, pictureBoxLainer.Height); - } - if (_strategy == null) - { - return; - } - comboBoxStrategy.Enabled = false; - _strategy.MakeStep(); - Draw(); - if (_strategy.GetStatus() == Status.Finish) - { - comboBoxStrategy.Enabled = true; - _strategy = null; - } - } - private void ButtonSelectLainer_Click(object sender, EventArgs e) - { - SelectedLainer = _drawningLainer; - DialogResult = DialogResult.OK; - } - } -} diff --git a/LainerForm.resx b/LainerForm.resx deleted file mode 100644 index 0f362c9..0000000 --- a/LainerForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file