PIBD-11 Shipilov N.S. Seaplane LabWork01 Simple LabWork1 #1

Closed
NikitaShipilov wants to merge 5 commits from LabWork1 into main
Showing only changes of commit d8fa13de94 - Show all commits

View File

@ -35,8 +35,27 @@ public class DrawingSeaplane
public bool SetPictureSize(int width, int height)
{
_pictureHeight = height;
if (_drawingSeaplaneWidth > width || _drawingSeaplaneHeight > height)
{
return false;
}
_pictureWidth = width;
_pictureHeight = height;
if (_startPosX.HasValue || _startPosY.HasValue)
{
if (_startPosX + _drawingSeaplaneWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _drawingSeaplaneWidth;
}
else if (_startPosX < 0) _startPosX = 0;
if (_startPosY + _drawingSeaplaneHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _drawingSeaplaneHeight;
}
else if (_startPosY < 0) _startPosY = 0;
}
return true;
}
@ -144,7 +163,7 @@ public class DrawingSeaplane
new Point(_startPosX.Value + 190, _startPosY.Value + 20)
};
g.DrawPolygon(pen, pointsFaceBottom);
Point[] pointsKeel = {
new Point(_startPosX.Value + 10, _startPosY.Value - 30),
new Point(_startPosX.Value + 10, _startPosY.Value + 5),