Ajoutez des fichiers projet.
This commit is contained in:
parent
5bc232faa6
commit
f852b35745
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27004.2002
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonhomme01", "Bonhomme01\Bonhomme01.csproj", "{B3C7D374-80DA-45F0-B97F-6320169C1BE7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C53F0596-CB41-43D0-97DF-706218E42504}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
class Bonhomme : Rectangle
|
||||
{
|
||||
public Jambe jambe1, jambe2;
|
||||
Jambe bras1, bras2;
|
||||
Cercle tete;
|
||||
int flag = 0;
|
||||
public Bonhomme(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical) : base(hebergeur, new Point(origine.X, origine.Y+Lhorizontal), Lhorizontal, Lvertical)
|
||||
{
|
||||
tete = new Cercle(hebergeur, origine, Lhorizontal, Lhorizontal);
|
||||
tete.fond = Color.Pink;
|
||||
origine = new Point(origine.X, origine.Y + Lhorizontal);
|
||||
jambe1 = new Jambe(hebergeur, new Point(origine.X + 4*(Lhorizontal / 10), origine.Y + Lvertical), (Lhorizontal / 5), Lvertical);
|
||||
jambe2 = new Jambe(hebergeur, new Point(origine.X + 4*(Lhorizontal / 10), origine.Y + Lvertical), (Lhorizontal / 5), Lvertical);
|
||||
bras1 = new Jambe(hebergeur, new Point(origine.X + 4 * (Lhorizontal / 10), origine.Y + Lvertical/5), (Lhorizontal / 5), Lvertical);
|
||||
bras2 = new Jambe(hebergeur, new Point(origine.X + 4 * (Lhorizontal / 10), origine.Y + Lvertical/5), (Lhorizontal / 5), Lvertical);
|
||||
bras1.Fond = Color.Blue;
|
||||
bras2.Fond = Color.Blue;
|
||||
}
|
||||
|
||||
public new void Afficher(IntPtr handle)
|
||||
{
|
||||
base.Afficher(handle);
|
||||
jambe1.Afficher(handle);
|
||||
jambe2.Afficher(handle);
|
||||
// bras1.Afficher(handle);
|
||||
// bras2.Afficher(handle);
|
||||
tete.Afficher(handle);
|
||||
}
|
||||
public new void Cacher(IntPtr handle)
|
||||
{
|
||||
base.Cacher(handle);
|
||||
jambe1.Cacher(handle);
|
||||
jambe2.Cacher(handle);
|
||||
bras1.Cacher(handle);
|
||||
bras2.Cacher(handle);
|
||||
tete.Cacher(handle);
|
||||
}
|
||||
public void Bouger(int x, int y, Jambe.AngleJambe angleJambe1, Jambe.AngleJambe angleJambe2)
|
||||
{
|
||||
if(flag == 0)
|
||||
jambe1.angleJambe = angleJambe1;
|
||||
flag = 2;
|
||||
if (jambe1.angleJambe.AngleBassin == 0 && jambe2.angleJambe.AngleBassin == 0 || 1==1)
|
||||
{
|
||||
//jambe1.Monter(2);
|
||||
jambe1.Avancer(-10);
|
||||
}
|
||||
else if (jambe1.angleJambe.AngleBassin != 0 && jambe2.angleJambe.AngleBassin == 0 && 1==2)
|
||||
{
|
||||
jambe1.angleJambe.AngleBassin -= 25;
|
||||
jambe1.angleJambe.AngleCheville -= 25;
|
||||
jambe1.angleJambe.AngleGenou -= 25;
|
||||
jambe2.angleJambe.AngleBassin = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
/*base.Origine = new Point(base.Origine.X+x, base.Origine.Y+y);
|
||||
jambe1.Origine = new Point(jambe1.Origine.X + x, jambe1.Origine.Y + y);
|
||||
jambe1.CentrerPointOrigine();
|
||||
jambe1.angleJambe = angleJambe1;
|
||||
|
||||
jambe2.Origine = new Point(jambe2.Origine.X + x, jambe2.Origine.Y + y);
|
||||
jambe2.CentrerPointOrigine();
|
||||
jambe2.angleJambe = angleJambe2;
|
||||
bras1.Origine = new Point(bras1.Origine.X + x, bras1.Origine.Y + y);
|
||||
bras2.Origine = new Point(bras2.Origine.X + x, bras2.Origine.Y + y);
|
||||
bras1.angleJambe = angleJambe1;
|
||||
bras2.angleJambe = angleJambe2;
|
||||
bras1.CentrerPointOrigine();
|
||||
bras2.CentrerPointOrigine();
|
||||
tete.Origine = new Point(tete.Origine.X + x, tete.Origine.Y + y);*/
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B3C7D374-80DA-45F0-B97F-6320169C1BE7}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Bonhomme01</RootNamespace>
|
||||
<AssemblyName>Bonhomme01</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Bonhomme.cs" />
|
||||
<Compile Include="Cercle.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Jambe.cs" />
|
||||
<Compile Include="PointComplexe.cs" />
|
||||
<Compile Include="PointOrigine.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Rectangle.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,179 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
class Cercle
|
||||
{
|
||||
private PictureBox hebergeur;
|
||||
public Color fond = Color.Red;
|
||||
public Color contour = Color.Black;
|
||||
public int eppaisseurContour = 1;
|
||||
public Color backgroud;
|
||||
public bool remplir = true;
|
||||
public bool visible = true;
|
||||
private Point origine, origineRotation;
|
||||
private Cercle rectParent;
|
||||
public bool parentFlag = false;
|
||||
bool setToCenterFlag = false;
|
||||
public bool memeOrigineOrigineRotation_flag = true;
|
||||
public int Lhorizontal, Lvertical;
|
||||
public float angleRotation;
|
||||
private int decalageY = 0, decalageX = 0;
|
||||
private int diam;
|
||||
|
||||
|
||||
public Cercle(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical)
|
||||
{
|
||||
this.hebergeur = hebergeur;
|
||||
origineRotation = this.origine = origine;
|
||||
this.Lhorizontal = Lhorizontal;
|
||||
this.Lvertical = Lvertical;
|
||||
this.parentFlag = false;
|
||||
angleRotation = 0;
|
||||
backgroud = hebergeur.BackColor;
|
||||
diam = Lhorizontal;
|
||||
}
|
||||
public Cercle(PictureBox hebergeur, int Lhorizontal, int Lvertical, ref Cercle rectParent, float angle)
|
||||
{
|
||||
this.hebergeur = hebergeur;
|
||||
this.parentFlag = true;
|
||||
this.Origine = rectParent.CIG;
|
||||
this.rectParent = rectParent;
|
||||
this.Lhorizontal = Lhorizontal;
|
||||
this.Lvertical = Lvertical;
|
||||
this.angleRotation = angle;
|
||||
backgroud = hebergeur.BackColor;
|
||||
diam = Lhorizontal;
|
||||
}
|
||||
public Cercle(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical, float angleRotation) : this(hebergeur, origine, Lhorizontal, Lvertical)
|
||||
{
|
||||
this.angleRotation = angleRotation;
|
||||
}
|
||||
public Cercle(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical, float angleRotation, Point origineRotation) : this(hebergeur, origine, Lhorizontal, Lvertical, angleRotation)
|
||||
{
|
||||
this.origineRotation = origineRotation;
|
||||
}
|
||||
#region pointPourRotation
|
||||
public PointComplexe CSG { get { return (new PointComplexe(Origine.X, Origine.Y, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
public PointComplexe CSD { get { return (new PointComplexe(Origine.X + Lhorizontal, Origine.Y, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
public PointComplexe CIG { get { return (new PointComplexe(Origine.X, Origine.Y + Lvertical, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
public PointComplexe CID { get { return (new PointComplexe(Origine.X + Lhorizontal, Origine.Y + Lvertical, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
#endregion
|
||||
|
||||
#region accesseur
|
||||
public Point Origine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (parentFlag)
|
||||
{
|
||||
return new Point(rectParent.CIG.X + decalageX, rectParent.CIG.Y + decalageY);
|
||||
}
|
||||
return new Point(origine.X - decalageX, origine.Y - decalageY);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (memeOrigineOrigineRotation_flag && !parentFlag)
|
||||
{
|
||||
origineRotation = origine = value;
|
||||
}
|
||||
else if (parentFlag)
|
||||
{
|
||||
origine = value;
|
||||
}
|
||||
else if (!parentFlag)
|
||||
{
|
||||
origineRotation = origine = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Point OrigineRotation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (memeOrigineOrigineRotation_flag)
|
||||
return Origine;
|
||||
else
|
||||
return origineRotation;
|
||||
}
|
||||
set
|
||||
{
|
||||
origineRotation = value;
|
||||
memeOrigineOrigineRotation_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void CentrerPointOrigine()
|
||||
{
|
||||
if (parentFlag)
|
||||
{
|
||||
decalageX = 0;
|
||||
decalageY = 0;
|
||||
Point millieuParent = PointComplexe.Millieux(rectParent.CIG, rectParent.CID);
|
||||
Point millieuxenfant = PointComplexe.Millieux(this.CSG, this.CSD);
|
||||
decalageX = millieuParent.X - millieuxenfant.X;
|
||||
decalageY = millieuParent.Y - millieuxenfant.Y;
|
||||
setToCenterFlag = false;
|
||||
}
|
||||
else if (!setToCenterFlag || 1 == 1)
|
||||
{
|
||||
float old = angleRotation;
|
||||
angleRotation = 0;
|
||||
OrigineRotation = PointComplexe.Millieux(this.CSG, this.CSD);
|
||||
setToCenterFlag = true;
|
||||
angleRotation = old;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region methode
|
||||
public void Afficher(IntPtr handle)
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
if (remplir)
|
||||
{
|
||||
gr.FillEllipse(new SolidBrush(fond), origine.X, origine.Y, diam, diam);
|
||||
}
|
||||
gr.DrawEllipse(new Pen(contour, eppaisseurContour), origine.X, origine.Y, diam, diam);
|
||||
}
|
||||
}
|
||||
public void Afficher(IntPtr handle, float angle)
|
||||
{
|
||||
this.angleRotation = angle;
|
||||
if (visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
if (remplir)
|
||||
{
|
||||
gr.FillEllipse(new SolidBrush(fond), origine.X, origine.Y, diam, diam);
|
||||
}
|
||||
gr.DrawEllipse(new Pen(contour, eppaisseurContour), origine.X, origine.Y, diam, diam);
|
||||
}
|
||||
}
|
||||
public void Cacher(IntPtr handle)
|
||||
{
|
||||
|
||||
if (visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
if (remplir)
|
||||
{
|
||||
gr.FillEllipse(new SolidBrush(backgroud), origine.X, origine.Y, diam, diam);
|
||||
}
|
||||
gr.DrawEllipse(new Pen(backgroud, eppaisseurContour), origine.X, origine.Y, diam, diam);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
namespace Bonhomme01
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Variable nécessaire au concepteur.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Nettoyage des ressources utilisées.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Code généré par le Concepteur Windows Form
|
||||
|
||||
/// <summary>
|
||||
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
|
||||
/// le contenu de cette méthode avec l'éditeur de code.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.TV = new System.Windows.Forms.PictureBox();
|
||||
this.timerImage = new System.Windows.Forms.Timer(this.components);
|
||||
this.btnEffacer = new System.Windows.Forms.Button();
|
||||
this.btnStopDeplacerCTick = new System.Windows.Forms.Button();
|
||||
this.btnCreationCarrosse = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TV)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TV
|
||||
//
|
||||
this.TV.Location = new System.Drawing.Point(13, 13);
|
||||
this.TV.Name = "TV";
|
||||
this.TV.Size = new System.Drawing.Size(782, 241);
|
||||
this.TV.TabIndex = 0;
|
||||
this.TV.TabStop = false;
|
||||
//
|
||||
// timerImage
|
||||
//
|
||||
this.timerImage.Interval = 40;
|
||||
this.timerImage.Tick += new System.EventHandler(this.timerImage_Tick);
|
||||
//
|
||||
// btnEffacer
|
||||
//
|
||||
this.btnEffacer.Location = new System.Drawing.Point(13, 305);
|
||||
this.btnEffacer.Name = "btnEffacer";
|
||||
this.btnEffacer.Size = new System.Drawing.Size(389, 23);
|
||||
this.btnEffacer.TabIndex = 10;
|
||||
this.btnEffacer.Text = "Effacer Tout";
|
||||
this.btnEffacer.UseVisualStyleBackColor = true;
|
||||
this.btnEffacer.Click += new System.EventHandler(this.btnEffacer_Click);
|
||||
//
|
||||
// btnStopDeplacerCTick
|
||||
//
|
||||
this.btnStopDeplacerCTick.Enabled = false;
|
||||
this.btnStopDeplacerCTick.Location = new System.Drawing.Point(408, 305);
|
||||
this.btnStopDeplacerCTick.Name = "btnStopDeplacerCTick";
|
||||
this.btnStopDeplacerCTick.Size = new System.Drawing.Size(387, 23);
|
||||
this.btnStopDeplacerCTick.TabIndex = 9;
|
||||
this.btnStopDeplacerCTick.Text = "Stop Tick";
|
||||
this.btnStopDeplacerCTick.UseVisualStyleBackColor = true;
|
||||
this.btnStopDeplacerCTick.Click += new System.EventHandler(this.btnStopDeplacerCTick_Click);
|
||||
//
|
||||
// btnCreationCarrosse
|
||||
//
|
||||
this.btnCreationCarrosse.Location = new System.Drawing.Point(13, 276);
|
||||
this.btnCreationCarrosse.Name = "btnCreationCarrosse";
|
||||
this.btnCreationCarrosse.Size = new System.Drawing.Size(782, 23);
|
||||
this.btnCreationCarrosse.TabIndex = 11;
|
||||
this.btnCreationCarrosse.Text = "Creer Carrosse";
|
||||
this.btnCreationCarrosse.UseVisualStyleBackColor = true;
|
||||
this.btnCreationCarrosse.Click += new System.EventHandler(this.btnCreationCarrosse_Click);
|
||||
//
|
||||
// EcranAccueil
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(807, 415);
|
||||
this.Controls.Add(this.btnCreationCarrosse);
|
||||
this.Controls.Add(this.btnEffacer);
|
||||
this.Controls.Add(this.btnStopDeplacerCTick);
|
||||
this.Controls.Add(this.TV);
|
||||
this.Name = "EcranAccueil";
|
||||
this.Text = "Dessins Animés";
|
||||
((System.ComponentModel.ISupportInitialize)(this.TV)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox TV;
|
||||
private System.Windows.Forms.Timer timerImage;
|
||||
private System.Windows.Forms.Button btnEffacer;
|
||||
private System.Windows.Forms.Button btnStopDeplacerCTick;
|
||||
private System.Windows.Forms.Button btnCreationCarrosse;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
private Bonhomme bonhomme;
|
||||
|
||||
private BufferedGraphics bufferG = null;
|
||||
private Graphics g;
|
||||
Jambe.AngleJambe angleJ1 = new Jambe.AngleJambe(-45, 45, 0);
|
||||
Jambe.AngleJambe angleJ2 = new Jambe.AngleJambe(-45, 45, 0);
|
||||
Jambe.AngleJambe brasJ1 = new Jambe.AngleJambe(-90, -90, -90);
|
||||
Jambe.AngleJambe brasJ2 = new Jambe.AngleJambe(-90, -90, -90);
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
// Modification contre le scintillement - Creation d'une mémoire tampon graphique
|
||||
bufferG = BufferedGraphicsManager.Current.Allocate(TV.CreateGraphics(), TV.DisplayRectangle);
|
||||
g = bufferG.Graphics;
|
||||
}
|
||||
|
||||
private void timerImage_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.bonhomme.Origine.X + this.bonhomme.Lhorizontal >= this.TV.Width)
|
||||
{
|
||||
this.timerImage.Stop();
|
||||
this.btnStopDeplacerCTick.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bonhomme.Cacher(this.TV.Handle);
|
||||
//angleJ1.AngleBassin += 1;
|
||||
//angleJ1.AngleCheville = angleJ1.AngleGenou += 2;
|
||||
//angleJ2.AngleBassin -= 1;
|
||||
//angleJ2.AngleCheville = angleJ2.AngleGenou -= 2;
|
||||
this.bonhomme.Cacher(this.TV.Handle);
|
||||
this.bonhomme.Bouger(1, 0, angleJ1, angleJ2);
|
||||
this.bonhomme.Afficher(this.TV.Handle);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnStopDeplacerCTick_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.timerImage.Stop();
|
||||
this.btnStopDeplacerCTick.Enabled = false;
|
||||
}
|
||||
|
||||
private void btnEffacer_Click(object sender, EventArgs e)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(this.TV.Handle);
|
||||
gr.FillRectangle(new SolidBrush(this.TV.BackColor), 0, 0, this.TV.Bounds.Width, this.TV.Bounds.Height);
|
||||
}
|
||||
|
||||
private void btnCreationCarrosse_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.bonhomme = new Bonhomme(TV, TV.Location, 30, 60);
|
||||
this.bonhomme.Bouger(0, 0, angleJ1, angleJ2);
|
||||
this.bonhomme.Afficher(this.TV.Handle);
|
||||
this.btnStopDeplacerCTick.Enabled = true;
|
||||
this.timerImage.Start();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
class Jambe : Rectangle
|
||||
{
|
||||
private int etapeMarche = 0;
|
||||
Rectangle jambeBas, pied;
|
||||
public Color Fond
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.fond;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.fond = jambeBas.fond = pied.fond = value;
|
||||
}
|
||||
}
|
||||
public struct AngleJambe
|
||||
{
|
||||
public float AngleBassin;
|
||||
public float AngleGenou;
|
||||
public float AngleCheville;
|
||||
public AngleJambe(float angleBassin, float angleGenou, float angleCheville)
|
||||
{
|
||||
this.AngleBassin = angleBassin;
|
||||
this.AngleGenou= angleGenou;
|
||||
this.AngleCheville = angleCheville;
|
||||
}
|
||||
}
|
||||
public AngleJambe angleJambe;
|
||||
public Jambe(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical) : base(hebergeur, origine, Lhorizontal, Lvertical/2)
|
||||
{
|
||||
|
||||
Rectangle me = this;
|
||||
angleJambe = new AngleJambe(0, 0, 0);
|
||||
base.angleRotation = angleJambe.AngleBassin;
|
||||
jambeBas = new Rectangle(hebergeur, Lhorizontal, Lvertical/2, ref me, angleJambe.AngleGenou);
|
||||
pied = new Rectangle(hebergeur, Lhorizontal*2, Lvertical/10, ref jambeBas, angleJambe.AngleCheville);
|
||||
}
|
||||
public Jambe(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical, AngleJambe angle) : base(hebergeur, origine, Lhorizontal, Lvertical/2, angle.AngleBassin)
|
||||
{
|
||||
Rectangle me = this;
|
||||
angleJambe = angle;
|
||||
jambeBas = new Rectangle(hebergeur, Lhorizontal, Lvertical/2, ref me, angleJambe.AngleGenou);
|
||||
pied = new Rectangle(hebergeur, Lhorizontal * 2, Lvertical/10, ref jambeBas, angleJambe.AngleCheville);
|
||||
}
|
||||
public Jambe(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical, AngleJambe angle, Point origineRotation) : base(hebergeur, origine, Lhorizontal, Lvertical/2, angle.AngleBassin, origineRotation)
|
||||
{
|
||||
Rectangle me = this;
|
||||
angleJambe = angle;
|
||||
jambeBas = new Rectangle(hebergeur, origine, Lhorizontal, Lvertical/2, angleJambe.AngleGenou, origineRotation);
|
||||
pied = new Rectangle(hebergeur, jambeBas.CIG, Lhorizontal * 2, Lvertical/10, angleJambe.AngleCheville, origineRotation);
|
||||
}
|
||||
public new void Afficher(IntPtr handle)
|
||||
{
|
||||
base.angleRotation = angleJambe.AngleBassin;
|
||||
jambeBas.angleRotation = angleJambe.AngleGenou;
|
||||
pied.angleRotation = angleJambe.AngleCheville;
|
||||
base.CentrerPointOrigine();
|
||||
base.Afficher(handle);
|
||||
jambeBas.CentrerPointOrigine();
|
||||
jambeBas.Afficher(handle);
|
||||
//pied.CentrerPointOrigine();
|
||||
pied.Afficher(handle);
|
||||
}
|
||||
public new void Cacher(IntPtr handle)
|
||||
{
|
||||
base.angleRotation = angleJambe.AngleBassin;
|
||||
jambeBas.angleRotation = angleJambe.AngleGenou;
|
||||
pied.angleRotation = angleJambe.AngleCheville;
|
||||
|
||||
base.Cacher(handle);
|
||||
jambeBas.Cacher(handle);
|
||||
pied.Cacher(handle);
|
||||
}
|
||||
public float Genou
|
||||
{
|
||||
get { return jambeBas.angleRotation; }
|
||||
set { jambeBas.angleRotation = angleJambe.AngleGenou = value%360; }
|
||||
}
|
||||
public float Cheville
|
||||
{
|
||||
get { return pied.angleRotation; }
|
||||
set { pied.angleRotation = angleJambe.AngleCheville =value%360; }
|
||||
}
|
||||
public void Bouger(int x, int y)
|
||||
{
|
||||
//Origine = new Point(Origine.X + x, Origine.Y + y);
|
||||
// jambeBas.Origine = new Point(jambeBas.Origine.X + x, jambeBas.Origine.Y + y);
|
||||
// pied.Origine = new Point(pied.Origine.X + x, pied.Origine.Y + y);
|
||||
}
|
||||
public void Monter(int x)
|
||||
{
|
||||
PointComplexe l = new PointComplexe(new PointComplexe(base.CSG, base.CSD).Millieux(), new PointComplexe(jambeBas.CIG, jambeBas.CID).Millieux());//Vecteur entre le haut et le bas du pied
|
||||
PointComplexe m = new PointComplexe(new PointComplexe(base.CSG, base.CSD).Millieux(), new PointComplexe(base.CIG, base.CID).Millieux());//Vecteur entre le haut et le bas du pied
|
||||
// var a = ((l.ABS - x) * (l.ABS - x));
|
||||
int lvertical = (int)m.ABS; //var b = (2 * (l.ABS - x) * Lvertical);
|
||||
Console.WriteLine("L:{0} vert:{1} x:{2}", l.ABS,lvertical, x);
|
||||
var bla = (Math.Pow((l.ABS - x), 2)) / (2 * (l.ABS)* (lvertical));
|
||||
Console.WriteLine("bla:{0}", bla);
|
||||
double angle = Math.Acos(bla);
|
||||
angle *= 180;
|
||||
angle /= Math.PI;
|
||||
Console.WriteLine(angle);
|
||||
angleJambe.AngleBassin = (float)-angle;
|
||||
angleJambe.AngleGenou = (float)angle;
|
||||
}
|
||||
public void Avancer(int x)
|
||||
{
|
||||
PointComplexe m = new PointComplexe(new PointComplexe(base.CSG, base.CSD).Millieux(), new PointComplexe(base.CIG, base.CID).Millieux());//Vecteur entre le haut et le bas du pied
|
||||
// var a = ((l.ABS - x) * (l.ABS - x));
|
||||
int lvertical = (int)m.ABS;
|
||||
|
||||
Complex origine = new Complex(base.CSG.X, base.CSG.Y);
|
||||
Complex Pointpied = new Complex(this.pied.CSG.X+x, this.pied.CSG.Y);
|
||||
Pointpied = Pointpied - origine;
|
||||
Complex Pointgenou;
|
||||
double genouxX, genouY;
|
||||
double a = Math.Pow(Pointpied.Real, 2) + Math.Pow(Pointpied.Imaginary, 2);
|
||||
a /= 2 * Pointpied.Imaginary;
|
||||
genouxX = 2 * a + 2 * Math.Sqrt(Math.Pow(a, 2)-lvertical);
|
||||
genouxX /= 4;
|
||||
genouY = a - genouxX;
|
||||
Pointgenou = new Complex(genouxX, genouY);
|
||||
angleJambe.AngleBassin += (float)Pointgenou.Phase;
|
||||
Pointpied = Pointpied - Pointgenou;
|
||||
angleJambe.AngleGenou += (float)Pointpied.Phase;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Numerics;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
class PointComplexe
|
||||
{
|
||||
Complex point;
|
||||
Complex origine;
|
||||
public int X
|
||||
{
|
||||
get { return (int)point.Real; }
|
||||
}
|
||||
public int Y
|
||||
{
|
||||
get { return (int)point.Imaginary; }
|
||||
}
|
||||
public double ABS
|
||||
{
|
||||
get
|
||||
{
|
||||
DeplacerSurOrigine();
|
||||
double abs = point.Magnitude;
|
||||
RetoursPosition();
|
||||
return abs;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
public PointComplexe(int x, int y, int xo, int yo)
|
||||
{
|
||||
point = new Complex(x, y);
|
||||
origine = new Complex(xo, yo);
|
||||
}
|
||||
public PointComplexe(PointComplexe a, PointComplexe b)
|
||||
{
|
||||
point = new Complex(b.X, b.Y);
|
||||
origine = new Complex(a.X, a.Y);
|
||||
}
|
||||
public PointComplexe(Point a, Point b)
|
||||
{
|
||||
point = new Complex(b.X, b.Y);
|
||||
origine = new Complex(a.X, a.Y);
|
||||
}
|
||||
public PointComplexe(int x, int y, int xo, int yo, double degre)
|
||||
{
|
||||
point = new Complex(x, y);
|
||||
origine = new Complex(xo, yo);
|
||||
//Console.WriteLine("Avent rotation {0}", point.ToString());
|
||||
|
||||
//Console.WriteLine("Avent rotation {0}", point.ToString());
|
||||
RotateDegre(degre);
|
||||
//Console.WriteLine("Après rotation {0}", point.ToString());
|
||||
|
||||
//Console.WriteLine("Après rotation {0}", point.ToString());
|
||||
}
|
||||
public void RotateDegre(double angle)
|
||||
{
|
||||
double radian = (angle%360) * (Math.PI / 180);
|
||||
point = Complex.Subtract(point, origine);
|
||||
point = Complex.FromPolarCoordinates(point.Magnitude, point.Phase + radian);
|
||||
point = Complex.Add(point, origine);
|
||||
}
|
||||
public void RotateRadian(float radian)
|
||||
{
|
||||
point = Complex.Subtract(point, origine);
|
||||
point = Complex.Add(point, Complex.FromPolarCoordinates(point.Magnitude, point.Phase + radian));
|
||||
point = Complex.Add(point, origine);
|
||||
}
|
||||
public static Point Millieux(PointComplexe a, PointComplexe b)
|
||||
{
|
||||
PointComplexe pt = new PointComplexe(a, b);
|
||||
pt.DeplacerSurOrigine();
|
||||
pt.point = Complex.FromPolarCoordinates(pt.point.Magnitude / 2, pt.point.Phase);
|
||||
pt.RetoursPosition();
|
||||
|
||||
return new Point(pt.X, pt.Y);
|
||||
}
|
||||
public Point Millieux()
|
||||
{
|
||||
DeplacerSurOrigine();
|
||||
point = Complex.FromPolarCoordinates(point.Magnitude / 2, point.Phase);
|
||||
RetoursPosition();
|
||||
|
||||
return new Point(X, Y);
|
||||
}
|
||||
public void DeplacerSurOrigine()
|
||||
{
|
||||
point = Complex.Subtract(point, origine);
|
||||
}
|
||||
public void RetoursPosition()
|
||||
{
|
||||
point = Complex.Add(point, origine);
|
||||
}
|
||||
|
||||
|
||||
public static implicit operator Point(PointComplexe point)
|
||||
{
|
||||
return new Point(point.X, point.Y);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
class PointOrigine
|
||||
{
|
||||
#region Données membres
|
||||
private int _X = 0;
|
||||
private int _Y = 0;
|
||||
private bool _Visible = true;
|
||||
private PictureBox _Hebergeur;
|
||||
private Color _Fond = Color.Silver;
|
||||
private Color _Crayon = Color.Black;
|
||||
#endregion
|
||||
|
||||
#region Constructeurs
|
||||
public PointOrigine()
|
||||
{
|
||||
this._Hebergeur = null;
|
||||
}
|
||||
|
||||
public PointOrigine(PictureBox hebergeur)
|
||||
{
|
||||
this._Hebergeur = hebergeur;
|
||||
this._Fond = hebergeur.BackColor;
|
||||
}
|
||||
|
||||
public PointOrigine(PictureBox hebergeur, int xy) : this (hebergeur)
|
||||
{
|
||||
X = Y = xy;
|
||||
}
|
||||
|
||||
public PointOrigine(PictureBox hebergeur, int x, int y) : this(hebergeur)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
public PointOrigine(int x, int y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
public PointOrigine(PictureBox hebergeur, int xy, Color crayon) : this(hebergeur, xy)
|
||||
{
|
||||
Crayon = crayon;
|
||||
}
|
||||
|
||||
public PointOrigine(PictureBox hebergeur, int x, int y, Color crayon) : this(hebergeur, x, y)
|
||||
{
|
||||
Crayon = crayon;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Accesseurs
|
||||
public int X
|
||||
{
|
||||
get { return _X; }
|
||||
set
|
||||
{
|
||||
if (value < 0) { this._X = 0; }
|
||||
else if (value > this._Hebergeur.Bounds.Size.Width) { this._X = this._Hebergeur.Bounds.Size.Width; }
|
||||
else { this._X = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public int Y
|
||||
{
|
||||
get { return _Y; }
|
||||
set
|
||||
{
|
||||
if (value < 0) { this._Y = 0; }
|
||||
else if (value > this._Hebergeur.Bounds.Size.Height) { this._Y = this._Hebergeur.Bounds.Size.Height; }
|
||||
else { this._Y = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
get { return _Visible; }
|
||||
set { _Visible = value; }
|
||||
}
|
||||
|
||||
public Color Fond
|
||||
{
|
||||
get { return _Fond; }
|
||||
set
|
||||
{
|
||||
try { _Fond = value; }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
public Color Crayon
|
||||
{
|
||||
get { return _Crayon; }
|
||||
set
|
||||
{
|
||||
try { _Crayon = value; }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
public PictureBox Hebergeur
|
||||
{
|
||||
get { return _Hebergeur; }
|
||||
set { _Hebergeur = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Méthodes
|
||||
public void Bouger(int deplX, int deplY)
|
||||
{
|
||||
X += deplX;
|
||||
Y += deplY;
|
||||
}
|
||||
|
||||
public virtual void Afficher(IntPtr handle)
|
||||
{
|
||||
if (this.Visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
gr.FillEllipse(new SolidBrush(Color.Yellow), this.X, this.Y, 6, 6);
|
||||
gr.DrawEllipse(new Pen(this._Crayon, 2), this.X, this.Y, 6, 6);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Cacher(IntPtr handle)
|
||||
{
|
||||
if (this.Visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
gr.FillEllipse(new SolidBrush(this.Fond), this.X, this.Y, 6, 6);
|
||||
gr.DrawEllipse(new Pen(this.Fond, 2), this.X, this.Y, 6, 6);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Point d'entrée principal de l'application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Les informations générales relatives à un assembly dépendent de
|
||||
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
|
||||
// associées à un assembly.
|
||||
[assembly: AssemblyTitle("Bonhomme01")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Bonhomme01")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
|
||||
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
|
||||
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
|
||||
[assembly: Guid("b3c7d374-80da-45f0-b97f-6320169c1be7")]
|
||||
|
||||
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
|
||||
//
|
||||
// Version principale
|
||||
// Version secondaire
|
||||
// Numéro de build
|
||||
// Révision
|
||||
//
|
||||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
||||
// en utilisant '*', comme indiqué ci-dessous :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,71 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Ce code a été généré par un outil.
|
||||
// Version du runtime :4.0.30319.42000
|
||||
//
|
||||
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
|
||||
// le code est régénéré.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Bonhomme01.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
|
||||
/// </summary>
|
||||
// Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
|
||||
// à l'aide d'un outil, tel que ResGen ou Visual Studio.
|
||||
// Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
|
||||
// avec l'option /str ou régénérez votre projet VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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>
|
||||
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bonhomme01.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes
|
||||
/// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, 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="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<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>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: 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: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" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</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" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -0,0 +1,30 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Bonhomme01.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
|
@ -0,0 +1,183 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme01
|
||||
{
|
||||
class Rectangle
|
||||
{
|
||||
private PictureBox hebergeur;
|
||||
public Color fond = Color.Red;
|
||||
public Color contour = Color.Black;
|
||||
public int eppaisseurContour = 1;
|
||||
public Color backgroud;
|
||||
public bool remplir = true;
|
||||
public bool visible = true;
|
||||
private Point origine, origineRotation;
|
||||
private Rectangle rectParent;
|
||||
public bool parentFlag = false;
|
||||
bool setToCenterFlag = false;
|
||||
public bool memeOrigineOrigineRotation_flag = true;
|
||||
public int Lhorizontal, Lvertical;
|
||||
public float angleRotation;
|
||||
private int decalageY = 0, decalageX = 0;
|
||||
|
||||
|
||||
public Rectangle(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical)
|
||||
{
|
||||
this.hebergeur = hebergeur;
|
||||
origineRotation = this.origine = origine;
|
||||
this.Lhorizontal = Lhorizontal;
|
||||
this.Lvertical = Lvertical;
|
||||
this.parentFlag = false;
|
||||
angleRotation = 0;
|
||||
backgroud = hebergeur.BackColor;
|
||||
}
|
||||
public Rectangle(PictureBox hebergeur, int Lhorizontal, int Lvertical, ref Rectangle rectParent, float angle)
|
||||
{
|
||||
this.hebergeur = hebergeur;
|
||||
this.parentFlag = true;
|
||||
this.Origine = rectParent.CIG;
|
||||
this.rectParent = rectParent;
|
||||
this.Lhorizontal = Lhorizontal;
|
||||
this.Lvertical = Lvertical;
|
||||
this.angleRotation = angle;
|
||||
backgroud = hebergeur.BackColor;
|
||||
}
|
||||
public Rectangle(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical, float angleRotation) : this(hebergeur, origine, Lhorizontal, Lvertical)
|
||||
{
|
||||
this.angleRotation = angleRotation;
|
||||
}
|
||||
public Rectangle(PictureBox hebergeur, Point origine, int Lhorizontal, int Lvertical, float angleRotation, Point origineRotation) : this(hebergeur, origine, Lhorizontal, Lvertical, angleRotation)
|
||||
{
|
||||
this.origineRotation = origineRotation;
|
||||
}
|
||||
#region pointPourRotation
|
||||
public PointComplexe CSG { get { return (new PointComplexe(Origine.X, Origine.Y, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
public PointComplexe CSD { get { return (new PointComplexe(Origine.X + Lhorizontal, Origine.Y, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
public PointComplexe CIG { get { return (new PointComplexe(Origine.X, Origine.Y + Lvertical, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
public PointComplexe CID { get { return (new PointComplexe(Origine.X + Lhorizontal, Origine.Y + Lvertical, OrigineRotation.X, OrigineRotation.Y, angleRotation)); } }
|
||||
#endregion
|
||||
|
||||
#region accesseur
|
||||
public Point Origine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (parentFlag)
|
||||
{
|
||||
return new Point(rectParent.CIG.X+decalageX, rectParent.CIG.Y+decalageY);
|
||||
}
|
||||
return new Point(origine.X - decalageX, origine.Y - decalageY);
|
||||
}
|
||||
set
|
||||
{
|
||||
if(memeOrigineOrigineRotation_flag && !parentFlag)
|
||||
{
|
||||
origineRotation = origine = value;
|
||||
}
|
||||
else if(parentFlag)
|
||||
{
|
||||
origine = value;
|
||||
}
|
||||
else if(!parentFlag)
|
||||
{
|
||||
origineRotation = origine = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Point OrigineRotation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (memeOrigineOrigineRotation_flag)
|
||||
return Origine;
|
||||
else
|
||||
return origineRotation;
|
||||
}
|
||||
set
|
||||
{
|
||||
origineRotation = value;
|
||||
memeOrigineOrigineRotation_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region methode
|
||||
public void Afficher(IntPtr handle)
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
if (remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(fond), l);
|
||||
|
||||
}
|
||||
gr.DrawClosedCurve(new Pen(contour, eppaisseurContour), l);
|
||||
}
|
||||
}
|
||||
public void Afficher(IntPtr handle, float angle)
|
||||
{
|
||||
this.angleRotation = angle;
|
||||
if (visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
if (remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(fond), l);
|
||||
}
|
||||
gr.DrawClosedCurve(new Pen(contour, eppaisseurContour), l);
|
||||
}
|
||||
}
|
||||
public void Cacher(IntPtr handle)
|
||||
{
|
||||
if (visible && 1 == 1)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
if (remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(this.backgroud), l);
|
||||
}
|
||||
gr.DrawClosedCurve(new Pen(this.backgroud, eppaisseurContour), l);
|
||||
}
|
||||
}
|
||||
|
||||
public void CentrerPointOrigine()
|
||||
{
|
||||
if (parentFlag)
|
||||
{
|
||||
float old = angleRotation;
|
||||
angleRotation = 0;
|
||||
decalageX = 0;
|
||||
decalageY = 0;
|
||||
Point millieuParent = PointComplexe.Millieux(rectParent.CIG, rectParent.CID);
|
||||
Point millieuxenfant = PointComplexe.Millieux(this.CSG, this.CSD);
|
||||
decalageX = millieuParent.X - millieuxenfant.X;
|
||||
decalageY = millieuParent.Y - millieuxenfant.Y;
|
||||
OrigineRotation = PointComplexe.Millieux(this.CSG, this.CSD);
|
||||
setToCenterFlag = true;
|
||||
angleRotation = old;
|
||||
}
|
||||
else if (!setToCenterFlag)
|
||||
{
|
||||
float old = angleRotation;
|
||||
angleRotation = 0;
|
||||
OrigineRotation = PointComplexe.Millieux(this.CSG, this.CSD);
|
||||
setToCenterFlag = true;
|
||||
angleRotation = old;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue