Изменено направление вывода объектов на форме с коллекцией объектов
This commit is contained in:
parent
f652dfcd18
commit
45c7fb8ab3
@ -46,7 +46,7 @@
|
|||||||
pictureBoxStormtrooper.Dock = DockStyle.Fill;
|
pictureBoxStormtrooper.Dock = DockStyle.Fill;
|
||||||
pictureBoxStormtrooper.Location = new Point(0, 0);
|
pictureBoxStormtrooper.Location = new Point(0, 0);
|
||||||
pictureBoxStormtrooper.Name = "pictureBoxStormtrooper";
|
pictureBoxStormtrooper.Name = "pictureBoxStormtrooper";
|
||||||
pictureBoxStormtrooper.Size = new Size(1043, 546);
|
pictureBoxStormtrooper.Size = new Size(948, 546);
|
||||||
pictureBoxStormtrooper.SizeMode = PictureBoxSizeMode.AutoSize;
|
pictureBoxStormtrooper.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||||
pictureBoxStormtrooper.TabIndex = 0;
|
pictureBoxStormtrooper.TabIndex = 0;
|
||||||
pictureBoxStormtrooper.TabStop = false;
|
pictureBoxStormtrooper.TabStop = false;
|
||||||
@ -67,7 +67,7 @@
|
|||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonUp.BackgroundImage = Properties.Resources.arrowUP;
|
buttonUp.BackgroundImage = Properties.Resources.arrowUP;
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonUp.Location = new Point(965, 468);
|
buttonUp.Location = new Point(870, 468);
|
||||||
buttonUp.Name = "buttonUp";
|
buttonUp.Name = "buttonUp";
|
||||||
buttonUp.Size = new Size(30, 30);
|
buttonUp.Size = new Size(30, 30);
|
||||||
buttonUp.TabIndex = 2;
|
buttonUp.TabIndex = 2;
|
||||||
@ -79,7 +79,7 @@
|
|||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonDown.BackgroundImage = Properties.Resources.arrowDOWN;
|
buttonDown.BackgroundImage = Properties.Resources.arrowDOWN;
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonDown.Location = new Point(965, 504);
|
buttonDown.Location = new Point(870, 504);
|
||||||
buttonDown.Name = "buttonDown";
|
buttonDown.Name = "buttonDown";
|
||||||
buttonDown.Size = new Size(30, 30);
|
buttonDown.Size = new Size(30, 30);
|
||||||
buttonDown.TabIndex = 3;
|
buttonDown.TabIndex = 3;
|
||||||
@ -91,7 +91,7 @@
|
|||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonLeft.BackgroundImage = Properties.Resources.arrowLEFT;
|
buttonLeft.BackgroundImage = Properties.Resources.arrowLEFT;
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonLeft.Location = new Point(929, 504);
|
buttonLeft.Location = new Point(834, 504);
|
||||||
buttonLeft.Name = "buttonLeft";
|
buttonLeft.Name = "buttonLeft";
|
||||||
buttonLeft.Size = new Size(30, 30);
|
buttonLeft.Size = new Size(30, 30);
|
||||||
buttonLeft.TabIndex = 4;
|
buttonLeft.TabIndex = 4;
|
||||||
@ -103,7 +103,7 @@
|
|||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonRight.BackgroundImage = Properties.Resources.arrowRIGHT;
|
buttonRight.BackgroundImage = Properties.Resources.arrowRIGHT;
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonRight.Location = new Point(1001, 504);
|
buttonRight.Location = new Point(906, 504);
|
||||||
buttonRight.Name = "buttonRight";
|
buttonRight.Name = "buttonRight";
|
||||||
buttonRight.Size = new Size(30, 30);
|
buttonRight.Size = new Size(30, 30);
|
||||||
buttonRight.TabIndex = 5;
|
buttonRight.TabIndex = 5;
|
||||||
@ -127,7 +127,7 @@
|
|||||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxStrategy.FormattingEnabled = true;
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToRightBottom" });
|
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToRightBottom" });
|
||||||
comboBoxStrategy.Location = new Point(880, 12);
|
comboBoxStrategy.Location = new Point(785, 12);
|
||||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
comboBoxStrategy.Size = new Size(151, 28);
|
comboBoxStrategy.Size = new Size(151, 28);
|
||||||
comboBoxStrategy.TabIndex = 7;
|
comboBoxStrategy.TabIndex = 7;
|
||||||
@ -135,7 +135,7 @@
|
|||||||
// buttonStep
|
// buttonStep
|
||||||
//
|
//
|
||||||
buttonStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
buttonStep.Location = new Point(937, 46);
|
buttonStep.Location = new Point(842, 46);
|
||||||
buttonStep.Name = "buttonStep";
|
buttonStep.Name = "buttonStep";
|
||||||
buttonStep.Size = new Size(94, 29);
|
buttonStep.Size = new Size(94, 29);
|
||||||
buttonStep.TabIndex = 8;
|
buttonStep.TabIndex = 8;
|
||||||
@ -157,7 +157,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1043, 546);
|
ClientSize = new Size(948, 546);
|
||||||
Controls.Add(buttonSelectPlane);
|
Controls.Add(buttonSelectPlane);
|
||||||
Controls.Add(buttonStep);
|
Controls.Add(buttonStep);
|
||||||
Controls.Add(comboBoxStrategy);
|
Controls.Add(comboBoxStrategy);
|
||||||
|
@ -116,14 +116,15 @@ namespace ProjectStormtrooper
|
|||||||
private void DrawObjects(Graphics g)
|
private void DrawObjects(Graphics g)
|
||||||
{
|
{
|
||||||
int placesColumnCount = _pictureHeight / _placeSizeHeight;
|
int placesColumnCount = _pictureHeight / _placeSizeHeight;
|
||||||
|
int placesRowCount = _pictureWidth / _placeSizeWidth;
|
||||||
for (int i = 0; i < _collection.Count; i++)
|
for (int i = 0; i < _collection.Count; i++)
|
||||||
{
|
{
|
||||||
// получение объекта
|
// получение объекта
|
||||||
var obj = _collection.Get(i);
|
var obj = _collection.Get(i);
|
||||||
// установка позиции
|
// установка позиции
|
||||||
obj?.SetPosition(
|
obj?.SetPosition(
|
||||||
(int)(i / placesColumnCount * _placeSizeWidth + (_placeSizeWidth - obj?.GetWidth) / 2),
|
(int)((placesRowCount - 1) * _placeSizeWidth - (i % placesColumnCount * _placeSizeWidth) + (_placeSizeWidth - obj?.GetWidth) / 2),
|
||||||
(int)(i % placesColumnCount * _placeSizeHeight + (_placeSizeHeight - obj?.GetHeight) / 2)
|
(int)(i / placesColumnCount * _placeSizeHeight + (_placeSizeHeight - obj?.GetHeight) / 2)
|
||||||
);
|
);
|
||||||
// прорисовка объекта
|
// прорисовка объекта
|
||||||
obj?.DrawTransport(g);
|
obj?.DrawTransport(g);
|
||||||
|
Loading…
Reference in New Issue
Block a user