Compare commits

...

10 Commits

Author SHA1 Message Date
a552939e52 lab. is done 2023-10-03 20:24:32 +04:00
00834f629d lab. is done 2023-10-03 20:02:47 +04:00
vladimir_zinovev
f69cd91c1d lab1 done 2023-09-22 13:52:05 +04:00
vladimir_zinovev
46c4250eeb edit lab1 2023-09-22 13:13:44 +04:00
vladimir_zinovev
d1179ba864 edit lab1 2023-09-22 13:06:04 +04:00
vladimir_zinovev
2a26a6d074 rm ds_store 2023-09-21 23:09:14 +04:00
vladimir_zinovev
4c5992cd4a rm ds_store 2023-09-21 23:07:00 +04:00
63a9eb093e lab1 is done 2023-09-21 22:32:58 +04:00
47a0a325e9 New Class Direction 2023-09-08 12:27:58 +04:00
87fd13d60a New Class EnityTank 2023-09-08 12:23:15 +04:00
23 changed files with 1297 additions and 621 deletions

803
.gitignore vendored
View File

@ -1,400 +1,403 @@
# ---> VisualStudio # ---> VisualStudio
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
## ##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files #mac file
*.rsuser .DS_Store
*.suo
*.user # User-specific files
*.userosscache *.rsuser
*.sln.docstates *.suo
*.user
# User-specific files (MonoDevelop/Xamarin Studio) *.userosscache
*.userprefs *.sln.docstates
# Mono auto generated files # User-specific files (MonoDevelop/Xamarin Studio)
mono_crash.* *.userprefs
# Build results # Mono auto generated files
[Dd]ebug/ mono_crash.*
[Dd]ebugPublic/
[Rr]elease/ # Build results
[Rr]eleases/ [Dd]ebug/
x64/ [Dd]ebugPublic/
x86/ [Rr]elease/
[Ww][Ii][Nn]32/ [Rr]eleases/
[Aa][Rr][Mm]/ x64/
[Aa][Rr][Mm]64/ x86/
bld/ [Ww][Ii][Nn]32/
[Bb]in/ [Aa][Rr][Mm]/
[Oo]bj/ [Aa][Rr][Mm]64/
[Ll]og/ bld/
[Ll]ogs/ [Bb]in/
[Oo]bj/
# Visual Studio 2015/2017 cache/options directory [Ll]og/
.vs/ [Ll]ogs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/ # Visual Studio 2015/2017 cache/options directory
.vs/
# Visual Studio 2017 auto generated files # Uncomment if you have tasks that create the project's static files in wwwroot
Generated\ Files/ #wwwroot/
# MSTest test Results # Visual Studio 2017 auto generated files
[Tt]est[Rr]esult*/ Generated\ Files/
[Bb]uild[Ll]og.*
# MSTest test Results
# NUnit [Tt]est[Rr]esult*/
*.VisualState.xml [Bb]uild[Ll]og.*
TestResult.xml
nunit-*.xml # NUnit
*.VisualState.xml
# Build Results of an ATL Project TestResult.xml
[Dd]ebugPS/ nunit-*.xml
[Rr]eleasePS/
dlldata.c # Build Results of an ATL Project
[Dd]ebugPS/
# Benchmark Results [Rr]eleasePS/
BenchmarkDotNet.Artifacts/ dlldata.c
# .NET Core # Benchmark Results
project.lock.json BenchmarkDotNet.Artifacts/
project.fragment.lock.json
artifacts/ # .NET Core
project.lock.json
# ASP.NET Scaffolding project.fragment.lock.json
ScaffoldingReadMe.txt artifacts/
# StyleCop # ASP.NET Scaffolding
StyleCopReport.xml ScaffoldingReadMe.txt
# Files built by Visual Studio # StyleCop
*_i.c StyleCopReport.xml
*_p.c
*_h.h # Files built by Visual Studio
*.ilk *_i.c
*.meta *_p.c
*.obj *_h.h
*.iobj *.ilk
*.pch *.meta
*.pdb *.obj
*.ipdb *.iobj
*.pgc *.pch
*.pgd *.pdb
*.rsp *.ipdb
*.sbr *.pgc
*.tlb *.pgd
*.tli *.rsp
*.tlh *.sbr
*.tmp *.tlb
*.tmp_proj *.tli
*_wpftmp.csproj *.tlh
*.log *.tmp
*.tlog *.tmp_proj
*.vspscc *_wpftmp.csproj
*.vssscc *.log
.builds *.tlog
*.pidb *.vspscc
*.svclog *.vssscc
*.scc .builds
*.pidb
# Chutzpah Test files *.svclog
_Chutzpah* *.scc
# Visual C++ cache files # Chutzpah Test files
ipch/ _Chutzpah*
*.aps
*.ncb # Visual C++ cache files
*.opendb ipch/
*.opensdf *.aps
*.sdf *.ncb
*.cachefile *.opendb
*.VC.db *.opensdf
*.VC.VC.opendb *.sdf
*.cachefile
# Visual Studio profiler *.VC.db
*.psess *.VC.VC.opendb
*.vsp
*.vspx # Visual Studio profiler
*.sap *.psess
*.vsp
# Visual Studio Trace Files *.vspx
*.e2e *.sap
# TFS 2012 Local Workspace # Visual Studio Trace Files
$tf/ *.e2e
# Guidance Automation Toolkit # TFS 2012 Local Workspace
*.gpState $tf/
# ReSharper is a .NET coding add-in # Guidance Automation Toolkit
_ReSharper*/ *.gpState
*.[Rr]e[Ss]harper
*.DotSettings.user # ReSharper is a .NET coding add-in
_ReSharper*/
# TeamCity is a build add-in *.[Rr]e[Ss]harper
_TeamCity* *.DotSettings.user
# DotCover is a Code Coverage Tool # TeamCity is a build add-in
*.dotCover _TeamCity*
# AxoCover is a Code Coverage Tool # DotCover is a Code Coverage Tool
.axoCover/* *.dotCover
!.axoCover/settings.json
# AxoCover is a Code Coverage Tool
# Coverlet is a free, cross platform Code Coverage Tool .axoCover/*
coverage*.json !.axoCover/settings.json
coverage*.xml
coverage*.info # Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
# Visual Studio code coverage results coverage*.xml
*.coverage coverage*.info
*.coveragexml
# Visual Studio code coverage results
# NCrunch *.coverage
_NCrunch_* *.coveragexml
.*crunch*.local.xml
nCrunchTemp_* # NCrunch
_NCrunch_*
# MightyMoose .*crunch*.local.xml
*.mm.* nCrunchTemp_*
AutoTest.Net/
# MightyMoose
# Web workbench (sass) *.mm.*
.sass-cache/ AutoTest.Net/
# Installshield output folder # Web workbench (sass)
[Ee]xpress/ .sass-cache/
# DocProject is a documentation generator add-in # Installshield output folder
DocProject/buildhelp/ [Ee]xpress/
DocProject/Help/*.HxT
DocProject/Help/*.HxC # DocProject is a documentation generator add-in
DocProject/Help/*.hhc DocProject/buildhelp/
DocProject/Help/*.hhk DocProject/Help/*.HxT
DocProject/Help/*.hhp DocProject/Help/*.HxC
DocProject/Help/Html2 DocProject/Help/*.hhc
DocProject/Help/html DocProject/Help/*.hhk
DocProject/Help/*.hhp
# Click-Once directory DocProject/Help/Html2
publish/ DocProject/Help/html
# Publish Web Output # Click-Once directory
*.[Pp]ublish.xml publish/
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings, # Publish Web Output
# but database connection strings (with potential passwords) will be unencrypted *.[Pp]ublish.xml
*.pubxml *.azurePubxml
*.publishproj # Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
# Microsoft Azure Web App publish settings. Comment the next line if you want to *.pubxml
# checkin your Azure Web App publish settings, but sensitive information contained *.publishproj
# in these scripts will be unencrypted
PublishScripts/ # Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# NuGet Packages # in these scripts will be unencrypted
*.nupkg PublishScripts/
# NuGet Symbol Packages
*.snupkg # NuGet Packages
# The packages folder can be ignored because of Package Restore *.nupkg
**/[Pp]ackages/* # NuGet Symbol Packages
# except build/, which is used as an MSBuild target. *.snupkg
!**/[Pp]ackages/build/ # The packages folder can be ignored because of Package Restore
# Uncomment if necessary however generally it will be regenerated when needed **/[Pp]ackages/*
#!**/[Pp]ackages/repositories.config # except build/, which is used as an MSBuild target.
# NuGet v3's project.json files produces more ignorable files !**/[Pp]ackages/build/
*.nuget.props # Uncomment if necessary however generally it will be regenerated when needed
*.nuget.targets #!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
# Microsoft Azure Build Output *.nuget.props
csx/ *.nuget.targets
*.build.csdef
# Microsoft Azure Build Output
# Microsoft Azure Emulator csx/
ecf/ *.build.csdef
rcf/
# Microsoft Azure Emulator
# Windows Store app package directories and files ecf/
AppPackages/ rcf/
BundleArtifacts/
Package.StoreAssociation.xml # Windows Store app package directories and files
_pkginfo.txt AppPackages/
*.appx BundleArtifacts/
*.appxbundle Package.StoreAssociation.xml
*.appxupload _pkginfo.txt
*.appx
# Visual Studio cache files *.appxbundle
# files ending in .cache can be ignored *.appxupload
*.[Cc]ache
# but keep track of directories ending in .cache # Visual Studio cache files
!?*.[Cc]ache/ # files ending in .cache can be ignored
*.[Cc]ache
# Others # but keep track of directories ending in .cache
ClientBin/ !?*.[Cc]ache/
~$*
*~ # Others
*.dbmdl ClientBin/
*.dbproj.schemaview ~$*
*.jfm *~
*.pfx *.dbmdl
*.publishsettings *.dbproj.schemaview
orleans.codegen.cs *.jfm
*.pfx
# Including strong name files can present a security risk *.publishsettings
# (https://github.com/github/gitignore/pull/2483#issue-259490424) orleans.codegen.cs
#*.snk
# Including strong name files can present a security risk
# Since there are multiple workflows, uncomment next line to ignore bower_components # (https://github.com/github/gitignore/pull/2483#issue-259490424)
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) #*.snk
#bower_components/
# Since there are multiple workflows, uncomment next line to ignore bower_components
# RIA/Silverlight projects # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
Generated_Code/ #bower_components/
# Backup & report files from converting an old project file # RIA/Silverlight projects
# to a newer Visual Studio version. Backup files are not needed, Generated_Code/
# because we have git ;-)
_UpgradeReport_Files/ # Backup & report files from converting an old project file
Backup*/ # to a newer Visual Studio version. Backup files are not needed,
UpgradeLog*.XML # because we have git ;-)
UpgradeLog*.htm _UpgradeReport_Files/
ServiceFabricBackup/ Backup*/
*.rptproj.bak UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files ServiceFabricBackup/
*.mdf *.rptproj.bak
*.ldf
*.ndf # SQL Server files
*.mdf
# Business Intelligence projects *.ldf
*.rdl.data *.ndf
*.bim.layout
*.bim_*.settings # Business Intelligence projects
*.rptproj.rsuser *.rdl.data
*- [Bb]ackup.rdl *.bim.layout
*- [Bb]ackup ([0-9]).rdl *.bim_*.settings
*- [Bb]ackup ([0-9][0-9]).rdl *.rptproj.rsuser
*- [Bb]ackup.rdl
# Microsoft Fakes *- [Bb]ackup ([0-9]).rdl
FakesAssemblies/ *- [Bb]ackup ([0-9][0-9]).rdl
# GhostDoc plugin setting file # Microsoft Fakes
*.GhostDoc.xml FakesAssemblies/
# Node.js Tools for Visual Studio # GhostDoc plugin setting file
.ntvs_analysis.dat *.GhostDoc.xml
node_modules/
# Node.js Tools for Visual Studio
# Visual Studio 6 build log .ntvs_analysis.dat
*.plg node_modules/
# Visual Studio 6 workspace options file # Visual Studio 6 build log
*.opt *.plg
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) # Visual Studio 6 workspace options file
*.vbw *.opt
# Visual Studio 6 auto-generated project file (contains which files were open etc.) # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbp *.vbw
# Visual Studio 6 workspace and project file (working project files containing files to include in project) # Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.dsw *.vbp
*.dsp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
# Visual Studio 6 technical files *.dsw
*.ncb *.dsp
*.aps
# Visual Studio 6 technical files
# Visual Studio LightSwitch build output *.ncb
**/*.HTMLClient/GeneratedArtifacts *.aps
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml # Visual Studio LightSwitch build output
**/*.Server/GeneratedArtifacts **/*.HTMLClient/GeneratedArtifacts
**/*.Server/ModelManifest.xml **/*.DesktopClient/GeneratedArtifacts
_Pvt_Extensions **/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
# Paket dependency manager **/*.Server/ModelManifest.xml
.paket/paket.exe _Pvt_Extensions
paket-files/
# Paket dependency manager
# FAKE - F# Make .paket/paket.exe
.fake/ paket-files/
# CodeRush personal settings # FAKE - F# Make
.cr/personal .fake/
# Python Tools for Visual Studio (PTVS) # CodeRush personal settings
__pycache__/ .cr/personal
*.pyc
# Python Tools for Visual Studio (PTVS)
# Cake - Uncomment if you are using it __pycache__/
# tools/** *.pyc
# !tools/packages.config
# Cake - Uncomment if you are using it
# Tabs Studio # tools/**
*.tss # !tools/packages.config
# Telerik's JustMock configuration file # Tabs Studio
*.jmconfig *.tss
# BizTalk build output # Telerik's JustMock configuration file
*.btp.cs *.jmconfig
*.btm.cs
*.odx.cs # BizTalk build output
*.xsd.cs *.btp.cs
*.btm.cs
# OpenCover UI analysis results *.odx.cs
OpenCover/ *.xsd.cs
# Azure Stream Analytics local run output # OpenCover UI analysis results
ASALocalRun/ OpenCover/
# MSBuild Binary and Structured Log # Azure Stream Analytics local run output
*.binlog ASALocalRun/
# NVidia Nsight GPU debugger configuration file # MSBuild Binary and Structured Log
*.nvuser *.binlog
# MFractors (Xamarin productivity tool) working folder # NVidia Nsight GPU debugger configuration file
.mfractor/ *.nvuser
# Local History for Visual Studio # MFractors (Xamarin productivity tool) working folder
.localhistory/ .mfractor/
# Visual Studio History (VSHistory) files # Local History for Visual Studio
.vshistory/ .localhistory/
# BeatPulse healthcheck temp database # Visual Studio History (VSHistory) files
healthchecksdb .vshistory/
# Backup folder for Package Reference Convert tool in Visual Studio 2017 # BeatPulse healthcheck temp database
MigrationBackup/ healthchecksdb
# Ionide (cross platform F# VS Code tools) working folder # Backup folder for Package Reference Convert tool in Visual Studio 2017
.ionide/ MigrationBackup/
# Fody - auto-generated XML schema # Ionide (cross platform F# VS Code tools) working folder
FodyWeavers.xsd .ionide/
# VS Code files for those working on multiple tools # Fody - auto-generated XML schema
.vscode/* FodyWeavers.xsd
!.vscode/settings.json
!.vscode/tasks.json # VS Code files for those working on multiple tools
!.vscode/launch.json .vscode/*
!.vscode/extensions.json !.vscode/settings.json
*.code-workspace !.vscode/tasks.json
!.vscode/launch.json
# Local History for Visual Studio Code !.vscode/extensions.json
.history/ *.code-workspace
# Windows Installer files from build outputs # Local History for Visual Studio Code
*.cab .history/
*.msi
*.msix # Windows Installer files from build outputs
*.msm *.cab
*.msp *.msi
*.msix
# JetBrains Rider *.msm
*.sln.iml *.msp
# JetBrains Rider
*.sln.iml

View File

@ -1,25 +1,25 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.4.33103.184 VisualStudioVersion = 17.4.33103.184
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectTank", "ProjectTank\ProjectTank.csproj", "{5365A6E1-3D16-42DB-80AE-69880B9C560C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectTank", "ProjectTank\ProjectTank.csproj", "{5365A6E1-3D16-42DB-80AE-69880B9C560C}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5365A6E1-3D16-42DB-80AE-69880B9C560C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5365A6E1-3D16-42DB-80AE-69880B9C560C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5365A6E1-3D16-42DB-80AE-69880B9C560C}.Debug|Any CPU.Build.0 = Debug|Any CPU {5365A6E1-3D16-42DB-80AE-69880B9C560C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5365A6E1-3D16-42DB-80AE-69880B9C560C}.Release|Any CPU.ActiveCfg = Release|Any CPU {5365A6E1-3D16-42DB-80AE-69880B9C560C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5365A6E1-3D16-42DB-80AE-69880B9C560C}.Release|Any CPU.Build.0 = Release|Any CPU {5365A6E1-3D16-42DB-80AE-69880B9C560C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {52BC5146-F9AB-4977-AA7D-3C2F3D505B4C} SolutionGuid = {52BC5146-F9AB-4977-AA7D-3C2F3D505B4C}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTank
{
public enum DirectionType
{
/// <summary>
/// Вверх
/// </summary>
Up = 1,
/// <summary>
/// Вниз
/// </summary>
Down = 2,
/// <summary>
/// Влево
/// </summary>
Left = 3,
/// <summary>
/// Вправо
/// </summary>
Right = 4
}
}

View File

@ -0,0 +1,200 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ProjectTank
{
public class DrawningTank
{
/// <summary>
/// Класс-сущность
/// </summary>
public EntityTank? _EntityTank { get; private set; }
/// <summary>
/// Ширина окна
/// </summary>
private int _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
private int _pictureHeight;
/// <summary>
/// Левая координата прорисовки танка
/// </summary>
private int _startPosX;
/// <summary>
/// Верхняя кооридната прорисовки танка
/// </summary>
private int _startPosY;
/// <summary>
/// Ширина прорисовки танка
/// </summary>
private readonly int _tankWidth = 200;
/// <summary>
/// Высота прорисовки танка
/// </summary>
private readonly int _tankHeight = 80;
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="width">Ширина картинки</param>
/// <param name="height">Высота картинки</param>
/// <returns>true - объект создан, false - проверка не пройдена,нельзя создать объект в этих размерах</returns>
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor,
bool gun, bool machineGun, int width, int height)
{
_pictureWidth = width;
_pictureHeight = height;
if ((_pictureHeight < _tankHeight) || (_pictureWidth < _tankWidth))
{
return false;
}
_EntityTank = new EntityTank();
_EntityTank.Init(speed, weight, gun, machineGun, bodyColor, additionalColor);
return true;
}
/// <summary>
/// Установка позиции
/// </summary>
/// <param name="x">Координата X</param>
/// <param name="y">Координата Y</param>
public void SetPosition(int x, int y)
{
if ((x < 0 || y < 0) || (x + _tankWidth > _pictureWidth || y + _tankHeight > _pictureHeight))
{
_startPosX = 0;
_startPosY = 0;
}
else
{
_startPosX = x;
_startPosY = y;
}
}
/// <summary>
/// Изменение направления перемещения
/// </summary>
/// <param name="direction">Направление</param>
public void MoveTransport(DirectionType direction)
{
if (_EntityTank == null)
{
return;
}
switch (direction)
{
//влево
case DirectionType.Left:
if (_startPosX - _EntityTank.Step > 0)
{
_startPosX -= (int)_EntityTank.Step;
}
break;
//вверх
case DirectionType.Up:
if (_startPosY - _EntityTank.Step > 0)
{
_startPosY -= (int)_EntityTank.Step;
}
break;
//вправо
case DirectionType.Right:
if (_startPosX + _tankWidth + _EntityTank.Step < _pictureWidth)
{
_startPosX += (int)_EntityTank.Step;
}
break;
//вниз
case DirectionType.Down:
if (_startPosY + _tankHeight + _EntityTank.Step < _pictureHeight)
{
_startPosY += (int)_EntityTank.Step;
}
break;
}
}
/// <summary>
/// Прорисовка объекта
/// </summary>
/// <param name="g"></param>
public void DrawTransport(Graphics g)
{
if (_EntityTank == null)
{
return;
}
Pen pen = new(Color.Black, 3);
Pen penGray = new(Color.Gray, 4);
Brush grayColorBrush = new SolidBrush(Color.Gray);
Brush blackColorBrush = new SolidBrush(Color.Black);
Brush additionalBrush = new SolidBrush(_EntityTank.AdditionalColor);
Brush bodyBrush = new SolidBrush(_EntityTank.BodyColor);
// Границы автомобиля
// гусеницы
g.DrawEllipse(pen, _startPosX+14, _startPosY+44, 151, 31);
g.FillEllipse(blackColorBrush, _startPosX + 15, _startPosY + 45, 150, 30);
g.DrawEllipse(penGray, _startPosX + 24, _startPosY + 54, 10, 10);
g.DrawEllipse(penGray, _startPosX + 144, _startPosY + 54, 10, 10);
g.DrawEllipse(penGray, _startPosX + 44, _startPosY + 59, 10, 10);
g.DrawEllipse(penGray, _startPosX + 124, _startPosY + 59, 10, 10);
g.DrawEllipse(penGray, _startPosX + 64, _startPosY + 61, 10, 10);
g.DrawEllipse(penGray, _startPosX + 104, _startPosY + 61, 10, 10);
g.DrawEllipse(penGray, _startPosX + 84, _startPosY + 62, 10, 10);
// Кузов
g.DrawRectangle(pen, _startPosX + 19, _startPosY + 34, 141, 21);
g.FillRectangle(bodyBrush, _startPosX+20, _startPosY+35, 140, 20);
// Башня
g.FillRectangle(blackColorBrush, _startPosX + 75, _startPosY + 10, 25, 5);
g.DrawRectangle(pen, _startPosX + 64, _startPosY + 14, 66, 21);
g.FillRectangle(additionalBrush, _startPosX + 65, _startPosY + 15, 65, 20);
//Точки для отрисовки передней и задней части
Point pointFirstBackSide = new Point(_startPosX + 18, _startPosY + 35);
Point pointSecondBackSide = new Point(_startPosX + 18, _startPosY + 55);
Point pointThirdBackSide = new Point(_startPosX+0, _startPosY+55);
Point pointFirstFrontSide = new Point(_startPosX + 162, _startPosY + 35);
Point pointSecondFrontSide = new Point(_startPosX + 185, _startPosY + 55);
Point pointThirdFrontSide = new Point(_startPosX + 162, _startPosY + 55);
// Задняя часть
Point[] backSide = { pointFirstBackSide, pointSecondBackSide, pointThirdBackSide };
g.DrawPolygon(pen, backSide);
g.FillPolygon(bodyBrush, backSide);
// Передняя часть
Point[] frontSide ={ pointFirstFrontSide, pointSecondFrontSide, pointThirdFrontSide };
g.DrawPolygon(pen, frontSide);
g.FillPolygon(bodyBrush, frontSide);
// пушка
if (_EntityTank.Gun)
{
g.DrawRectangle(pen, _startPosX + 129, _startPosY + 19, 56, 6);
g.FillRectangle(additionalBrush, _startPosX + 130, _startPosY + 20, 55, 5);
g.DrawRectangle(pen, _startPosX + 184, _startPosY + 17, 16, 11);
g.FillRectangle(blackColorBrush, _startPosX + 185, _startPosY + 18, 15, 10);
}
// пулемет
if (_EntityTank.MachineGun)
{
g.DrawRectangle(pen, _startPosX + 104, _startPosY + 9, 16, 6);
g.FillRectangle(additionalBrush, _startPosX + 105, _startPosY + 10, 15, 5);
g.DrawRectangle(pen, _startPosX + 111, _startPosY, 4, 6);
g.FillRectangle(additionalBrush, _startPosX + 112, _startPosY + 1, 4, 7);
g.FillRectangle(blackColorBrush, _startPosX + 98, _startPosY, 7, 7);
g.DrawRectangle(pen, _startPosX + 104, _startPosY + 2, 30, 3);
g.FillRectangle(additionalBrush, _startPosX + 105, _startPosY + 3, 29, 3);
g.FillRectangle(blackColorBrush, _startPosX + 135, _startPosY, 15, 8);
}
}
}
}

View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTank
{
public class EntityTank
{
/// <summary>
/// Скорость
/// </summary>
public int Speed { get; private set; }
/// <summary>
/// Вес
/// </summary>
public double Weight { get; private set; }
/// <summary>
/// Пушка
/// </summary>
public bool Gun { get; private set; }
/// <summary>
/// Пулемет
/// </summary>
public bool MachineGun { get; private set; }
/// <summary>
/// Основной цвет
/// </summary>
public Color BodyColor { get; private set; }
/// <summary>
/// Дополнительный цвет (для опциональных элементов)
/// </summary>
public Color AdditionalColor { get; private set; }
/// <summary>
/// Расчет шага по карте
/// </summary>
public double Step => (double)Speed * 100 / Weight;
/// <summary>
/// Инициализация полей объекта-класса спортивного автомобиля
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="gun">Признак наличия пушки</param>
/// <param name="machineGun">Признак наличия пулемета</param>
///
public void Init(int speed, double weight, bool gun,
bool machineGun, Color bodyColor, Color additionalColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
Gun = gun;
MachineGun = machineGun;
}
}
}

View File

@ -1,39 +0,0 @@
namespace ProjectTank
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

@ -1,10 +0,0 @@
namespace ProjectTank
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -1,17 +1,17 @@
namespace ProjectTank using System.Drawing;
{
internal static class Program namespace ProjectTank
{ {
/// <summary> internal static class Program
/// The main entry point for the application. {
/// </summary> /// <summary>
[STAThread] /// The main entry point for the application.
static void Main() /// </summary>
{ [STAThread]
// To customize application configuration such as set high DPI settings or default font, static void Main()
// see https://aka.ms/applicationconfiguration. {
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new Form1()); Application.Run(new TankForm());
} }
} }
} }

View File

@ -1,11 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectTank.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectTank.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap btnDown {
get {
object obj = ResourceManager.GetObject("btnDown", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap btnLeft {
get {
object obj = ResourceManager.GetObject("btnLeft", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap btnRight {
get {
object obj = ResourceManager.GetObject("btnRight", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap btnUp {
get {
object obj = ResourceManager.GetObject("btnUp", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -1,120 +1,133 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btnDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="btnLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btnLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="btnRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btnRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="btnUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btnUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

View File

@ -0,0 +1,155 @@
namespace ProjectTank
{
partial class TankForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pictureBoxTanks = new System.Windows.Forms.PictureBox();
this.ButtonCreateTank = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTanks)).BeginInit();
this.SuspendLayout();
//
// pictureBoxTanks
//
this.pictureBoxTanks.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxTanks.Location = new System.Drawing.Point(0, 0);
this.pictureBoxTanks.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.pictureBoxTanks.Name = "pictureBoxTanks";
this.pictureBoxTanks.Size = new System.Drawing.Size(1445, 881);
this.pictureBoxTanks.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBoxTanks.TabIndex = 0;
this.pictureBoxTanks.TabStop = false;
//
// ButtonCreateTank
//
this.ButtonCreateTank.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ButtonCreateTank.Location = new System.Drawing.Point(22, 806);
this.ButtonCreateTank.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.ButtonCreateTank.Name = "ButtonCreateTank";
this.ButtonCreateTank.Size = new System.Drawing.Size(139, 49);
this.ButtonCreateTank.TabIndex = 1;
this.ButtonCreateTank.Text = "Создать";
this.ButtonCreateTank.UseVisualStyleBackColor = true;
this.ButtonCreateTank.Click += new System.EventHandler(this.ButtonCreateTank_Click);
//
// buttonUp
//
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::ProjectTank.Properties.Resources.btnUp;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(1300, 730);
this.buttonUp.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(56, 64);
this.buttonUp.TabIndex = 2;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonRight
//
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::ProjectTank.Properties.Resources.btnRight;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(1367, 806);
this.buttonRight.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(56, 64);
this.buttonRight.TabIndex = 3;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonLeft
//
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::ProjectTank.Properties.Resources.btnLeft;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(1233, 806);
this.buttonLeft.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(56, 64);
this.buttonLeft.TabIndex = 4;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::ProjectTank.Properties.Resources.btnDown;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(1300, 806);
this.buttonDown.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(56, 64);
this.buttonDown.TabIndex = 5;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(1172, 0);
this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 32);
this.label1.TabIndex = 6;
//
// TankForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1445, 881);
this.Controls.Add(this.label1);
this.Controls.Add(this.buttonDown);
this.Controls.Add(this.buttonLeft);
this.Controls.Add(this.buttonRight);
this.Controls.Add(this.buttonUp);
this.Controls.Add(this.ButtonCreateTank);
this.Controls.Add(this.pictureBoxTanks);
this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
this.Name = "TankForm";
this.Text = "Tank";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTanks)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Button ButtonCreateTank;
private Button buttonUp;
private Button buttonRight;
private Button buttonLeft;
private Button buttonDown;
public PictureBox pictureBoxTanks;
private Label label1;
}
}

View File

@ -0,0 +1,81 @@
using System.Reflection.Emit;
namespace ProjectTank
{
/// <summary>
/// Ôîðìà ðàáîòû ñ îáúåêòîì "Òàíê"
/// </summary>
public partial class TankForm : Form
{
/// <summary>
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
/// </summary>
private DrawningTank? _drawningTank;
/// <summary>
/// Èíèöèàëèçàöèÿ ôîðìû
/// </summary>
public TankForm()
{
InitializeComponent();
}
/// <summary>
/// Ìåòîä ïðîðèñîâêè ìàøèíû
/// </summary>
private void Draw()
{
if (_drawningTank == null)
{
return;
}
Bitmap bmp = new(pictureBoxTanks.Width, pictureBoxTanks.Height);
Graphics gr = Graphics.FromImage(bmp);
_drawningTank.DrawTransport(gr);
pictureBoxTanks.Image = bmp;
}
/// <summary>
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü"
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonCreateTank_Click(object sender, EventArgs e)
{
Random random = new();
_drawningTank = new DrawningTank();
_drawningTank.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
pictureBoxTanks.Width, pictureBoxTanks.Height);
_drawningTank.SetPosition(random.Next(0, 100), random.Next(0, 100));
Draw();
}
/// <summary>
/// Èçìåíåíèå ðàçìåðîâ ôîðìû
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_drawningTank == null)
{
return;
}
string name = ((Button)sender)?.Name ?? string.Empty;
switch (name)
{
case "buttonUp":
_drawningTank.MoveTransport(DirectionType.Up);
break;
case "buttonDown":
_drawningTank.MoveTransport(DirectionType.Down);
break;
case "buttonLeft":
_drawningTank.MoveTransport(DirectionType.Left);
break;
case "buttonRight":
_drawningTank.MoveTransport(DirectionType.Right);
break;
}
Draw();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,3 +1,3 @@
# ISEbd-21_Zinovev_V.V._Tank_Basic # ISEbd-21_Zinovev_V.V._Tank_Basic
ИСэбд-21 Зиновьев В.В. Танк Базовое задание. ИСэбд-21 Зиновьев В.В. Танк Базовое задание.

BIN
images/btnDown.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

BIN
images/btnLeft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

BIN
images/btnRight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

BIN
images/btnUp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B