Лабораторная работа №1
This commit is contained in:
parent
51f0767cc1
commit
98dc9e75f3
35
ProjectSportCar/FormMonorail.Designer.cs
generated
35
ProjectSportCar/FormMonorail.Designer.cs
generated
@ -42,9 +42,10 @@
|
||||
buttonMove_Right.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonMove_Right.BackgroundImage = Properties.Resources.ArrowRight;
|
||||
buttonMove_Right.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonMove_Right.Location = new Point(766, 427);
|
||||
buttonMove_Right.Location = new Point(875, 569);
|
||||
buttonMove_Right.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonMove_Right.Name = "buttonMove_Right";
|
||||
buttonMove_Right.Size = new Size(35, 35);
|
||||
buttonMove_Right.Size = new Size(40, 47);
|
||||
buttonMove_Right.TabIndex = 0;
|
||||
buttonMove_Right.UseVisualStyleBackColor = true;
|
||||
buttonMove_Right.Click += ButtonMove_Click;
|
||||
@ -54,9 +55,10 @@
|
||||
buttonMove_Down.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonMove_Down.BackgroundImage = Properties.Resources.ArrowDown;
|
||||
buttonMove_Down.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonMove_Down.Location = new Point(725, 427);
|
||||
buttonMove_Down.Location = new Point(829, 569);
|
||||
buttonMove_Down.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonMove_Down.Name = "buttonMove_Down";
|
||||
buttonMove_Down.Size = new Size(35, 35);
|
||||
buttonMove_Down.Size = new Size(40, 47);
|
||||
buttonMove_Down.TabIndex = 1;
|
||||
buttonMove_Down.UseVisualStyleBackColor = true;
|
||||
buttonMove_Down.Click += ButtonMove_Click;
|
||||
@ -66,9 +68,10 @@
|
||||
buttonMove_Left.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonMove_Left.BackgroundImage = Properties.Resources.ArrowLeft;
|
||||
buttonMove_Left.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonMove_Left.Location = new Point(684, 427);
|
||||
buttonMove_Left.Location = new Point(782, 569);
|
||||
buttonMove_Left.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonMove_Left.Name = "buttonMove_Left";
|
||||
buttonMove_Left.Size = new Size(35, 35);
|
||||
buttonMove_Left.Size = new Size(40, 47);
|
||||
buttonMove_Left.TabIndex = 2;
|
||||
buttonMove_Left.UseVisualStyleBackColor = true;
|
||||
buttonMove_Left.Click += ButtonMove_Click;
|
||||
@ -78,9 +81,10 @@
|
||||
buttonMove_Up.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonMove_Up.BackgroundImage = Properties.Resources.ArrowUp;
|
||||
buttonMove_Up.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonMove_Up.Location = new Point(725, 386);
|
||||
buttonMove_Up.Location = new Point(829, 515);
|
||||
buttonMove_Up.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonMove_Up.Name = "buttonMove_Up";
|
||||
buttonMove_Up.Size = new Size(35, 35);
|
||||
buttonMove_Up.Size = new Size(40, 47);
|
||||
buttonMove_Up.TabIndex = 3;
|
||||
buttonMove_Up.UseVisualStyleBackColor = true;
|
||||
buttonMove_Up.Click += ButtonMove_Click;
|
||||
@ -90,17 +94,19 @@
|
||||
pictureBoxMonorail.Dock = DockStyle.Fill;
|
||||
pictureBoxMonorail.ImageLocation = "";
|
||||
pictureBoxMonorail.Location = new Point(0, 0);
|
||||
pictureBoxMonorail.Margin = new Padding(3, 4, 3, 4);
|
||||
pictureBoxMonorail.Name = "pictureBoxMonorail";
|
||||
pictureBoxMonorail.Size = new Size(813, 474);
|
||||
pictureBoxMonorail.Size = new Size(929, 632);
|
||||
pictureBoxMonorail.TabIndex = 4;
|
||||
pictureBoxMonorail.TabStop = false;
|
||||
//
|
||||
// buttonCreateMonorail
|
||||
//
|
||||
buttonCreateMonorail.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateMonorail.Location = new Point(12, 439);
|
||||
buttonCreateMonorail.Location = new Point(14, 585);
|
||||
buttonCreateMonorail.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCreateMonorail.Name = "buttonCreateMonorail";
|
||||
buttonCreateMonorail.Size = new Size(75, 23);
|
||||
buttonCreateMonorail.Size = new Size(86, 31);
|
||||
buttonCreateMonorail.TabIndex = 5;
|
||||
buttonCreateMonorail.Text = "Создать";
|
||||
buttonCreateMonorail.UseVisualStyleBackColor = true;
|
||||
@ -108,17 +114,18 @@
|
||||
//
|
||||
// FormMonorail
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(813, 474);
|
||||
ClientSize = new Size(929, 632);
|
||||
Controls.Add(buttonCreateMonorail);
|
||||
Controls.Add(buttonMove_Up);
|
||||
Controls.Add(buttonMove_Left);
|
||||
Controls.Add(buttonMove_Down);
|
||||
Controls.Add(buttonMove_Right);
|
||||
Controls.Add(pictureBoxMonorail);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormMonorail";
|
||||
Text = "P";
|
||||
Text = "Монорельс";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxMonorail).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
@ -71,6 +71,18 @@ namespace ProjectMonorail.Scripts.Locomative
|
||||
// если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена
|
||||
if (_drawningMonorailWidth > width || _drawningMonorailHeight > height) return false;
|
||||
|
||||
if (_startPositionX.HasValue && _startPositionY.HasValue)
|
||||
{
|
||||
if (_startPositionX.Value + _drawningMonorailWidth > width)
|
||||
{
|
||||
_startPositionX = width - _drawningMonorailWidth;
|
||||
}
|
||||
if (_startPositionY.Value + _drawningMonorailHeight > height)
|
||||
{
|
||||
_startPositionY = height - _drawningMonorailHeight;
|
||||
}
|
||||
}
|
||||
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user