Premier test BaseBJ OK

This commit is contained in:
adri 2018-01-04 14:03:06 +01:00
parent e56d064bba
commit cf33f65f33
6 changed files with 42 additions and 75 deletions

View File

@ -7,22 +7,32 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Bonhomme02
{
class BaseBJ
{
Peau Haut, Millieux, Bas, parent;
double angleHaut, angleMillieux, angleBas;
double angleHaut, angleMillieux, angleBas, longueur;
public BaseBJ()
{
}
public BaseBJ(ref Peau parent, ref Peau bas, double epaisseur)
public BaseBJ(PictureBox Hebergeur, ref Peau parent, Peau bas, double longueur, double epaisseur, double angle)
{
this.parent = parent;
Bas = bas;
angleHaut = angleMillieux = angleBas = 0;
this.Haut = new Peau(Hebergeur, ref parent, longueur/2, epaisseur, angle);
this.Millieux = new Peau(Hebergeur, ref this.Haut, longueur/2, epaisseur, angle);
this.Bas = bas;
this.Bas.parent = this.Millieux;
}
public void Afficher(IntPtr handle)
{
Haut.Afficher(handle);
Millieux.Afficher(handle);
Bas.Afficher(handle);
}
}

View File

@ -64,6 +64,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tete.cs" />
<Compile Include="Vecteur_.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@ -41,7 +41,7 @@
//
this.TV.Location = new System.Drawing.Point(13, 13);
this.TV.Name = "TV";
this.TV.Size = new System.Drawing.Size(782, 241);
this.TV.Size = new System.Drawing.Size(782, 449);
this.TV.TabIndex = 0;
this.TV.TabStop = false;
//
@ -52,7 +52,7 @@
//
// btnEffacer
//
this.btnEffacer.Location = new System.Drawing.Point(13, 305);
this.btnEffacer.Location = new System.Drawing.Point(13, 497);
this.btnEffacer.Name = "btnEffacer";
this.btnEffacer.Size = new System.Drawing.Size(389, 23);
this.btnEffacer.TabIndex = 10;
@ -63,7 +63,7 @@
// btnStopDeplacerCTick
//
this.btnStopDeplacerCTick.Enabled = false;
this.btnStopDeplacerCTick.Location = new System.Drawing.Point(408, 305);
this.btnStopDeplacerCTick.Location = new System.Drawing.Point(408, 497);
this.btnStopDeplacerCTick.Name = "btnStopDeplacerCTick";
this.btnStopDeplacerCTick.Size = new System.Drawing.Size(387, 23);
this.btnStopDeplacerCTick.TabIndex = 9;
@ -73,7 +73,7 @@
//
// btnCreationCarrosse
//
this.btnCreationCarrosse.Location = new System.Drawing.Point(13, 276);
this.btnCreationCarrosse.Location = new System.Drawing.Point(13, 468);
this.btnCreationCarrosse.Name = "btnCreationCarrosse";
this.btnCreationCarrosse.Size = new System.Drawing.Size(782, 23);
this.btnCreationCarrosse.TabIndex = 11;
@ -81,22 +81,20 @@
this.btnCreationCarrosse.UseVisualStyleBackColor = true;
this.btnCreationCarrosse.Click += new System.EventHandler(this.btnCreationCarrosse_Click);
//
// EcranAccueil
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(807, 415);
this.ClientSize = new System.Drawing.Size(807, 538);
this.Controls.Add(this.btnCreationCarrosse);
this.Controls.Add(this.btnEffacer);
this.Controls.Add(this.btnStopDeplacerCTick);
this.Controls.Add(this.TV);
this.Name = "EcranAccueil";
this.Name = "Form1";
this.Text = "Dessins Animés";
((System.ComponentModel.ISupportInitialize)(this.TV)).EndInit();
this.ResumeLayout(false);
}
#endregion

View File

@ -13,8 +13,9 @@ namespace Bonhomme02
public partial class Form1 : Form
{
private Bonhomme bonhomme;
private Peau jambe;
private BaseBJ jambe;
private Pied pied;
private Peau corp;
private BufferedGraphics bufferG = null;
private Graphics g;
@ -52,10 +53,12 @@ namespace Bonhomme02
private void btnCreationCarrosse_Click(object sender, EventArgs e)
{
jambe = new Peau(this.TV, 80, 80, 50, 10, Math.PI/2);
pied = new Pied(this.TV, ref jambe, 25, 10, Math.PI/8);
corp = new Peau(this.TV, 80, 80, 100, 40, Math.PI / 2);
pied = new Pied(this.TV, 25, 10, 0);
jambe = new BaseBJ(this.TV, ref corp, pied, 80, 10, Math.PI / 2);
jambe.Afficher(this.TV.Handle);
pied.Afficher(this.TV.Handle);
corp.Afficher(this.TV.Handle);
}
}
}

View File

@ -21,7 +21,10 @@ namespace Bonhomme02
public Peau(PictureBox hebergeur) : base(hebergeur)
{
}
public Peau(PictureBox hebergeur, double lg, double ep, double angle) : base(hebergeur)
{
InitVecteurs(lg, ep, angle);
}
public Peau(PictureBox hebergeur, int xy) : base(hebergeur, xy)
{
}
@ -75,13 +78,14 @@ namespace Bonhomme02
{
if (parent != null)
{
return parent.coordonnee+parent.longueur;
return parent.Coordonnee+parent.longueur;
}
else
return base.coordonnee;
}
}
public virtual Point CIG{ get{ return Coordonnee - epaisseur; }}
public virtual Point CID{ get{ return Coordonnee + epaisseur; }}
public virtual Point CSG{ get{ return (Coordonnee - epaisseur) + longueur; }}

View File

@ -32,7 +32,11 @@ namespace Bonhomme02
public Pied(PictureBox hebergeur) : base(hebergeur)
{
}
public Pied(PictureBox hebergeur, double lg, double ep, double angle) : base(hebergeur, lg, ep, angle)
{
InitVecteurs(lg, ep, angle);
}
public Pied(PictureBox hebergeur, int xy) : base(hebergeur, xy)
{
}
@ -44,7 +48,6 @@ namespace Bonhomme02
public Pied(PictureBox hebergeur, ref Peau parent, double lg, double ep, double angle) : base(hebergeur, parent.coordonnee.X, parent.Coordonnee.Y, lg, ep, angle)
{
base.parent = parent;
talon = new Vecteur(lg , angle);
InitVecteurs(lg, ep, angle);
}
public Pied(int x, int y) : base(x, y)
@ -71,63 +74,9 @@ namespace Bonhomme02
{
base.longueur = new Vecteur(lg, angle);
base.epaisseur = new Vecteur(ep, ref base.longueur, true);
talon = new Vecteur(lg / 2, angle);
}
/* public override void Afficher(IntPtr handle)
{
if (base.Visible)
{
try
{
Graphics gr = Graphics.FromHwnd(handle);
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
if (base.Remplir)
{
gr.FillClosedCurve(new SolidBrush(Color.Blue), l);
}
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
}
catch
{
}
}
}*/
/*public override 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 override void Cacher(IntPtr handle)
{
try
{
if (base.Visible && 1 == 1)
{
Graphics gr = Graphics.FromHwnd(handle);
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
if (base.Remplir)
{
gr.FillClosedCurve(new SolidBrush(base.Fond), l);
}
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
}
}
catch
{
}
}*/
#endregion
}
}