diff --git a/Sailboat/Sailboat/BoatsGenericCollection.cs b/Sailboat/Sailboat/BoatsGenericCollection.cs index 3e6b5eb..0634074 100644 --- a/Sailboat/Sailboat/BoatsGenericCollection.cs +++ b/Sailboat/Sailboat/BoatsGenericCollection.cs @@ -37,8 +37,10 @@ namespace Sailboat.Generics /// Набор объектов /// private readonly SetGeneric _collection; - internal IEnumerable GetBoats; - + /// + /// Получение объектов коллекции + /// + public IEnumerable GetBoats => _collection.GetBoats(); /// /// Конструктор /// @@ -49,7 +51,7 @@ namespace Sailboat.Generics int width = picWidth / _placeSizeWidth; int height = picHeight / _placeSizeHeight; _pictureWidth = picWidth; - _pictureHeight = picHeight - 0; + _pictureHeight = picHeight; _collection = new SetGeneric(width * height); } /// @@ -135,6 +137,8 @@ namespace Sailboat.Generics if (boat != null) { int width = _pictureWidth / _placeSizeWidth; + boat._pictureWidth = _pictureWidth; + boat._pictureHeight = _pictureHeight; boat.SetPosition(i % width * _placeSizeWidth, i / width * _placeSizeHeight); boat.DrawTransport(g); } @@ -142,4 +146,4 @@ namespace Sailboat.Generics } } } -} +} \ No newline at end of file diff --git a/Sailboat/Sailboat/DrawingBoat.cs b/Sailboat/Sailboat/DrawingBoat.cs index cb11f8a..b229abf 100644 --- a/Sailboat/Sailboat/DrawingBoat.cs +++ b/Sailboat/Sailboat/DrawingBoat.cs @@ -12,8 +12,8 @@ namespace Sailboat.DrawingObjects public class DrawingBoat { public EntityBoat? EntityBoat { get; protected set; } - private int _pictureWidth; - private int _pictureHeight; + public int _pictureWidth; + public int _pictureHeight; protected int _startPosX; protected int _startPosY; private readonly int _boatWidth = 160; diff --git a/Sailboat/Sailboat/FormBoatCollection.Designer.cs b/Sailboat/Sailboat/FormBoatCollection.Designer.cs index 412bb7f..b655025 100644 --- a/Sailboat/Sailboat/FormBoatCollection.Designer.cs +++ b/Sailboat/Sailboat/FormBoatCollection.Designer.cs @@ -28,207 +28,215 @@ /// private void InitializeComponent() { - this.pictureBoxCollection = new System.Windows.Forms.PictureBox(); - this.panelTools = new System.Windows.Forms.Panel(); - this.panelCollection = new System.Windows.Forms.Panel(); - this.buttonDelObject = new System.Windows.Forms.Button(); - this.listBoxStorages = new System.Windows.Forms.ListBox(); - this.buttonAddObject = new System.Windows.Forms.Button(); - this.textBoxStorageName = new System.Windows.Forms.TextBox(); - this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox(); - this.buttonRefreshCollection = new System.Windows.Forms.Button(); - this.buttonRemoveBoat = new System.Windows.Forms.Button(); - this.buttonAddBoat = new System.Windows.Forms.Button(); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); - this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit(); - this.panelTools.SuspendLayout(); - this.panelCollection.SuspendLayout(); - this.menuStrip.SuspendLayout(); - this.SuspendLayout(); + pictureBoxCollection = new PictureBox(); + panelTools = new Panel(); + panelCollection = new Panel(); + buttonDelObject = new Button(); + listBoxStorages = new ListBox(); + buttonAddObject = new Button(); + textBoxStorageName = new TextBox(); + maskedTextBoxNumber = new MaskedTextBox(); + buttonRefreshCollection = new Button(); + buttonRemoveBoat = new Button(); + buttonAddBoat = new Button(); + menuStrip = new MenuStrip(); + toolStripMenuItem1 = new ToolStripMenuItem(); + ToolStripMenuItem = new ToolStripMenuItem(); + SaveToolStripMenuItem = new ToolStripMenuItem(); + LoadToolStripMenuItem = new ToolStripMenuItem(); + openFileDialog = new OpenFileDialog(); + saveFileDialog = new SaveFileDialog(); + ((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit(); + panelTools.SuspendLayout(); + panelCollection.SuspendLayout(); + menuStrip.SuspendLayout(); + SuspendLayout(); // // pictureBoxCollection // - this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0); - this.pictureBoxCollection.Name = "pictureBoxCollection"; - this.pictureBoxCollection.Size = new System.Drawing.Size(750, 600); - this.pictureBoxCollection.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBoxCollection.TabIndex = 0; - this.pictureBoxCollection.TabStop = false; + pictureBoxCollection.Location = new Point(0, 0); + pictureBoxCollection.Margin = new Padding(3, 2, 3, 2); + pictureBoxCollection.Name = "pictureBoxCollection"; + pictureBoxCollection.Size = new Size(750, 600); + pictureBoxCollection.SizeMode = PictureBoxSizeMode.AutoSize; + pictureBoxCollection.TabIndex = 0; + pictureBoxCollection.TabStop = false; // // panelTools // - this.panelTools.BackColor = System.Drawing.SystemColors.ScrollBar; - this.panelTools.Controls.Add(this.panelCollection); - this.panelTools.Controls.Add(this.maskedTextBoxNumber); - this.panelTools.Controls.Add(this.buttonRefreshCollection); - this.panelTools.Controls.Add(this.buttonRemoveBoat); - this.panelTools.Controls.Add(this.buttonAddBoat); - this.panelTools.Controls.Add(this.menuStrip); - this.panelTools.Location = new System.Drawing.Point(756, 0); - this.panelTools.Name = "panelTools"; - this.panelTools.Size = new System.Drawing.Size(209, 722); - this.panelTools.TabIndex = 1; + panelTools.BackColor = SystemColors.ScrollBar; + panelTools.Controls.Add(panelCollection); + panelTools.Controls.Add(maskedTextBoxNumber); + panelTools.Controls.Add(buttonRefreshCollection); + panelTools.Controls.Add(buttonRemoveBoat); + panelTools.Controls.Add(buttonAddBoat); + panelTools.Controls.Add(menuStrip); + panelTools.Location = new Point(689, 0); + panelTools.Margin = new Padding(3, 2, 3, 2); + panelTools.Name = "panelTools"; + panelTools.Size = new Size(183, 542); + panelTools.TabIndex = 1; // // panelCollection // - this.panelCollection.BackColor = System.Drawing.SystemColors.AppWorkspace; - this.panelCollection.Controls.Add(this.buttonDelObject); - this.panelCollection.Controls.Add(this.listBoxStorages); - this.panelCollection.Controls.Add(this.buttonAddObject); - this.panelCollection.Controls.Add(this.textBoxStorageName); - this.panelCollection.Location = new System.Drawing.Point(20, 166); - this.panelCollection.Name = "panelCollection"; - this.panelCollection.Size = new System.Drawing.Size(181, 287); - this.panelCollection.TabIndex = 4; + panelCollection.BackColor = SystemColors.AppWorkspace; + panelCollection.Controls.Add(buttonDelObject); + panelCollection.Controls.Add(listBoxStorages); + panelCollection.Controls.Add(buttonAddObject); + panelCollection.Controls.Add(textBoxStorageName); + panelCollection.Location = new Point(18, 124); + panelCollection.Margin = new Padding(3, 2, 3, 2); + panelCollection.Name = "panelCollection"; + panelCollection.Size = new Size(158, 215); + panelCollection.TabIndex = 4; // // buttonDelObject // - this.buttonDelObject.Location = new System.Drawing.Point(12, 230); - this.buttonDelObject.Name = "buttonDelObject"; - this.buttonDelObject.Size = new System.Drawing.Size(154, 34); - this.buttonDelObject.TabIndex = 5; - this.buttonDelObject.Text = "Удалить набор"; - this.buttonDelObject.UseVisualStyleBackColor = true; - this.buttonDelObject.Click += new System.EventHandler(this.buttonDelObject_Click); + buttonDelObject.Location = new Point(10, 172); + buttonDelObject.Margin = new Padding(3, 2, 3, 2); + buttonDelObject.Name = "buttonDelObject"; + buttonDelObject.Size = new Size(135, 26); + buttonDelObject.TabIndex = 5; + buttonDelObject.Text = "Удалить набор"; + buttonDelObject.UseVisualStyleBackColor = true; + buttonDelObject.Click += buttonDelObject_Click; // // listBoxStorages // - this.listBoxStorages.FormattingEnabled = true; - this.listBoxStorages.ItemHeight = 20; - this.listBoxStorages.Location = new System.Drawing.Point(12, 102); - this.listBoxStorages.Name = "listBoxStorages"; - this.listBoxStorages.Size = new System.Drawing.Size(154, 104); - this.listBoxStorages.TabIndex = 6; - this.listBoxStorages.SelectedIndexChanged += new System.EventHandler(this.ListBoxObjects_SelectedIndexChanged); + listBoxStorages.FormattingEnabled = true; + listBoxStorages.ItemHeight = 15; + listBoxStorages.Location = new Point(10, 76); + listBoxStorages.Margin = new Padding(3, 2, 3, 2); + listBoxStorages.Name = "listBoxStorages"; + listBoxStorages.Size = new Size(135, 79); + listBoxStorages.TabIndex = 6; + listBoxStorages.SelectedIndexChanged += ListBoxObjects_SelectedIndexChanged; // // buttonAddObject // - this.buttonAddObject.Location = new System.Drawing.Point(12, 62); - this.buttonAddObject.Name = "buttonAddObject"; - this.buttonAddObject.Size = new System.Drawing.Size(154, 34); - this.buttonAddObject.TabIndex = 5; - this.buttonAddObject.Text = "Добавить набор"; - this.buttonAddObject.UseVisualStyleBackColor = true; - this.buttonAddObject.Click += new System.EventHandler(this.buttonAddObject_Click); + buttonAddObject.Location = new Point(10, 46); + buttonAddObject.Margin = new Padding(3, 2, 3, 2); + buttonAddObject.Name = "buttonAddObject"; + buttonAddObject.Size = new Size(135, 26); + buttonAddObject.TabIndex = 5; + buttonAddObject.Text = "Добавить набор"; + buttonAddObject.UseVisualStyleBackColor = true; + buttonAddObject.Click += buttonAddObject_Click; // // textBoxStorageName // - this.textBoxStorageName.Location = new System.Drawing.Point(29, 29); - this.textBoxStorageName.Name = "textBoxStorageName"; - this.textBoxStorageName.Size = new System.Drawing.Size(125, 27); - this.textBoxStorageName.TabIndex = 0; + textBoxStorageName.Location = new Point(25, 22); + textBoxStorageName.Margin = new Padding(3, 2, 3, 2); + textBoxStorageName.Name = "textBoxStorageName"; + textBoxStorageName.Size = new Size(110, 23); + textBoxStorageName.TabIndex = 0; // // maskedTextBoxNumber // - this.maskedTextBoxNumber.Location = new System.Drawing.Point(49, 567); - this.maskedTextBoxNumber.Name = "maskedTextBoxNumber"; - this.maskedTextBoxNumber.Size = new System.Drawing.Size(125, 27); - this.maskedTextBoxNumber.TabIndex = 3; + maskedTextBoxNumber.Location = new Point(43, 425); + maskedTextBoxNumber.Margin = new Padding(3, 2, 3, 2); + maskedTextBoxNumber.Name = "maskedTextBoxNumber"; + maskedTextBoxNumber.Size = new Size(110, 23); + maskedTextBoxNumber.TabIndex = 3; // // buttonRefreshCollection // - this.buttonRefreshCollection.Location = new System.Drawing.Point(20, 682); - this.buttonRefreshCollection.Name = "buttonRefreshCollection"; - this.buttonRefreshCollection.Size = new System.Drawing.Size(180, 34); - this.buttonRefreshCollection.TabIndex = 2; - this.buttonRefreshCollection.Text = "Обновить коллекцию"; - this.buttonRefreshCollection.UseVisualStyleBackColor = true; - this.buttonRefreshCollection.Click += new System.EventHandler(this.buttonRefreshCollection_Click); + buttonRefreshCollection.Location = new Point(18, 512); + buttonRefreshCollection.Margin = new Padding(3, 2, 3, 2); + buttonRefreshCollection.Name = "buttonRefreshCollection"; + buttonRefreshCollection.Size = new Size(158, 26); + buttonRefreshCollection.TabIndex = 2; + buttonRefreshCollection.Text = "Обновить коллекцию"; + buttonRefreshCollection.UseVisualStyleBackColor = true; + buttonRefreshCollection.Click += buttonRefreshCollection_Click; // // buttonRemoveBoat // - this.buttonRemoveBoat.Location = new System.Drawing.Point(21, 620); - this.buttonRemoveBoat.Name = "buttonRemoveBoat"; - this.buttonRemoveBoat.Size = new System.Drawing.Size(180, 34); - this.buttonRemoveBoat.TabIndex = 1; - this.buttonRemoveBoat.Text = "Удалить лодку"; - this.buttonRemoveBoat.UseVisualStyleBackColor = true; - this.buttonRemoveBoat.Click += new System.EventHandler(this.buttonRemoveBoat_Click); + buttonRemoveBoat.Location = new Point(18, 465); + buttonRemoveBoat.Margin = new Padding(3, 2, 3, 2); + buttonRemoveBoat.Name = "buttonRemoveBoat"; + buttonRemoveBoat.Size = new Size(158, 26); + buttonRemoveBoat.TabIndex = 1; + buttonRemoveBoat.Text = "Удалить лодку"; + buttonRemoveBoat.UseVisualStyleBackColor = true; + buttonRemoveBoat.Click += buttonRemoveBoat_Click; // // buttonAddBoat // - this.buttonAddBoat.Location = new System.Drawing.Point(20, 490); - this.buttonAddBoat.Name = "buttonAddBoat"; - this.buttonAddBoat.Size = new System.Drawing.Size(180, 34); - this.buttonAddBoat.TabIndex = 0; - this.buttonAddBoat.Text = "Добавить лодку"; - this.buttonAddBoat.UseVisualStyleBackColor = true; - this.buttonAddBoat.Click += new System.EventHandler(this.buttonAddBoat_Click); + buttonAddBoat.Location = new Point(18, 368); + buttonAddBoat.Margin = new Padding(3, 2, 3, 2); + buttonAddBoat.Name = "buttonAddBoat"; + buttonAddBoat.Size = new Size(158, 26); + buttonAddBoat.TabIndex = 0; + buttonAddBoat.Text = "Добавить лодку"; + buttonAddBoat.UseVisualStyleBackColor = true; + buttonAddBoat.Click += buttonAddBoat_Click; // // menuStrip // - this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItem1, - this.ToolStripMenuItem}); - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(209, 28); - this.menuStrip.TabIndex = 5; + menuStrip.ImageScalingSize = new Size(20, 20); + menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem1, ToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Padding = new Padding(5, 2, 0, 2); + menuStrip.Size = new Size(183, 24); + menuStrip.TabIndex = 5; // // toolStripMenuItem1 // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(14, 24); + toolStripMenuItem1.Name = "toolStripMenuItem1"; + toolStripMenuItem1.Size = new Size(12, 20); // // ToolStripMenuItem // - this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SaveToolStripMenuItem, - this.LoadToolStripMenuItem}); - this.ToolStripMenuItem.Name = "ToolStripMenuItem"; - this.ToolStripMenuItem.Size = new System.Drawing.Size(59, 24); - this.ToolStripMenuItem.Text = "Файл"; + ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem }); + ToolStripMenuItem.Name = "ToolStripMenuItem"; + ToolStripMenuItem.Size = new Size(48, 20); + ToolStripMenuItem.Text = "Файл"; // // SaveToolStripMenuItem // - this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; - this.SaveToolStripMenuItem.Size = new System.Drawing.Size(224, 26); - this.SaveToolStripMenuItem.Text = "Сохранение"; - this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click); + SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; + SaveToolStripMenuItem.Size = new Size(141, 22); + SaveToolStripMenuItem.Text = "Сохранение"; + SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click; // // LoadToolStripMenuItem // - this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; - this.LoadToolStripMenuItem.Size = new System.Drawing.Size(224, 26); - this.LoadToolStripMenuItem.Text = "Загрузка"; - this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click); + LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; + LoadToolStripMenuItem.Size = new Size(141, 22); + LoadToolStripMenuItem.Text = "Загрузка"; + LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click; // // openFileDialog // - this.openFileDialog.FileName = "openFileDialog"; - this.openFileDialog.Filter = "txt file | *.txt"; + openFileDialog.FileName = "openFileDialog"; + openFileDialog.Filter = "txt file | *.txt"; // // saveFileDialog // - this.saveFileDialog.Filter = "txt file | *.txt"; + saveFileDialog.Filter = "txt file | *.txt"; // // FormBoatCollection // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(969, 728); - this.Controls.Add(this.panelTools); - this.Controls.Add(this.pictureBoxCollection); - this.MainMenuStrip = this.menuStrip; - this.Name = "FormBoatCollection"; - this.Text = "FormBoatCollection"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit(); - this.panelTools.ResumeLayout(false); - this.panelTools.PerformLayout(); - this.panelCollection.ResumeLayout(false); - this.panelCollection.PerformLayout(); - this.menuStrip.ResumeLayout(false); - this.menuStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(884, 546); + Controls.Add(panelTools); + Controls.Add(pictureBoxCollection); + MainMenuStrip = menuStrip; + Margin = new Padding(3, 2, 3, 2); + Name = "FormBoatCollection"; + Text = "FormBoatCollection"; + ((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit(); + panelTools.ResumeLayout(false); + panelTools.PerformLayout(); + panelCollection.ResumeLayout(false); + panelCollection.PerformLayout(); + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); } #endregion