diff --git a/Bonhomme01.sln b/Bonhomme01.sln
new file mode 100644
index 0000000..e4bccf0
--- /dev/null
+++ b/Bonhomme01.sln
@@ -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
diff --git a/Bonhomme01/App.config b/Bonhomme01/App.config
new file mode 100644
index 0000000..731f6de
--- /dev/null
+++ b/Bonhomme01/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Bonhomme01/Bonhomme.cs b/Bonhomme01/Bonhomme.cs
new file mode 100644
index 0000000..6fc01fa
--- /dev/null
+++ b/Bonhomme01/Bonhomme.cs
@@ -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);*/
+ }
+ }
+}
diff --git a/Bonhomme01/Bonhomme01.csproj b/Bonhomme01/Bonhomme01.csproj
new file mode 100644
index 0000000..889fa94
--- /dev/null
+++ b/Bonhomme01/Bonhomme01.csproj
@@ -0,0 +1,86 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {B3C7D374-80DA-45F0-B97F-6320169C1BE7}
+ WinExe
+ Bonhomme01
+ Bonhomme01
+ v4.6.1
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form1.cs
+
+
+
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Bonhomme01/Cercle.cs b/Bonhomme01/Cercle.cs
new file mode 100644
index 0000000..01d6832
--- /dev/null
+++ b/Bonhomme01/Cercle.cs
@@ -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
+ }
+}
diff --git a/Bonhomme01/Form1.Designer.cs b/Bonhomme01/Form1.Designer.cs
new file mode 100644
index 0000000..61e8f6d
--- /dev/null
+++ b/Bonhomme01/Form1.Designer.cs
@@ -0,0 +1,111 @@
+namespace Bonhomme01
+{
+ partial class Form1
+ {
+ ///
+ /// Variable nécessaire au concepteur.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Nettoyage des ressources utilisées.
+ ///
+ /// true si les ressources managées doivent être supprimées ; sinon, false.
+ 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
+
+ ///
+ /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
+ /// le contenu de cette méthode avec l'éditeur de code.
+ ///
+ 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;
+ }
+}
+
diff --git a/Bonhomme01/Form1.cs b/Bonhomme01/Form1.cs
new file mode 100644
index 0000000..cb4d625
--- /dev/null
+++ b/Bonhomme01/Form1.cs
@@ -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();
+ }
+ }
+}
diff --git a/Bonhomme01/Jambe.cs b/Bonhomme01/Jambe.cs
new file mode 100644
index 0000000..4337cc2
--- /dev/null
+++ b/Bonhomme01/Jambe.cs
@@ -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;
+ }
+ }
+}
diff --git a/Bonhomme01/PointComplexe.cs b/Bonhomme01/PointComplexe.cs
new file mode 100644
index 0000000..cb5f71b
--- /dev/null
+++ b/Bonhomme01/PointComplexe.cs
@@ -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);
+ }
+
+ }
+}
diff --git a/Bonhomme01/PointOrigine.cs b/Bonhomme01/PointOrigine.cs
new file mode 100644
index 0000000..7a6ffaf
--- /dev/null
+++ b/Bonhomme01/PointOrigine.cs
@@ -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
+ }
+}
diff --git a/Bonhomme01/Program.cs b/Bonhomme01/Program.cs
new file mode 100644
index 0000000..d1fed2d
--- /dev/null
+++ b/Bonhomme01/Program.cs
@@ -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
+ {
+ ///
+ /// Point d'entrée principal de l'application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+}
diff --git a/Bonhomme01/Properties/AssemblyInfo.cs b/Bonhomme01/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..eaf05e7
--- /dev/null
+++ b/Bonhomme01/Properties/AssemblyInfo.cs
@@ -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")]
diff --git a/Bonhomme01/Properties/Resources.Designer.cs b/Bonhomme01/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..355df07
--- /dev/null
+++ b/Bonhomme01/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// 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é.
+//
+//------------------------------------------------------------------------------
+
+namespace Bonhomme01.Properties
+{
+
+
+ ///
+ /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
+ ///
+ // 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()
+ {
+ }
+
+ ///
+ /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
+ ///
+ [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;
+ }
+ }
+
+ ///
+ /// Remplace la propriété CurrentUICulture du thread actuel pour toutes
+ /// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Bonhomme01/Properties/Resources.resx b/Bonhomme01/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Bonhomme01/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Bonhomme01/Properties/Settings.Designer.cs b/Bonhomme01/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..f41253a
--- /dev/null
+++ b/Bonhomme01/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// 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.
+//
+//------------------------------------------------------------------------------
+
+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;
+ }
+ }
+ }
+}
diff --git a/Bonhomme01/Properties/Settings.settings b/Bonhomme01/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/Bonhomme01/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Bonhomme01/Rectangle.cs b/Bonhomme01/Rectangle.cs
new file mode 100644
index 0000000..c50432c
--- /dev/null
+++ b/Bonhomme01/Rectangle.cs
@@ -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
+
+ }
+}