bonhomeExamJanvier/Bonhomme02/Bonhomme.cs

88 lines
2.6 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Bonhomme02
{
class Bonhomme : Peau
{
public Tete tete;
public Jambe jambe1, jambe2;
public Bras bras;
public PictureBox conteneur;
public Bonhomme() : base()
{
}
public Bonhomme(ref PictureBox hebergeur) : base( hebergeur)
{
this.conteneur = hebergeur;
}
public Bonhomme(ref PictureBox hebergeur, double lg, double ep, double angle) : base( hebergeur, lg, ep, angle)
{
this.conteneur = hebergeur;
}
public Bonhomme(ref PictureBox hebergeur, int xy) : base( hebergeur, xy)
{
this.conteneur = hebergeur;
}
public Bonhomme(ref PictureBox hebergeur, int x, int y, double lg, double ep, double angle) : base( hebergeur, x, y, lg, ep, angle)
{
this.conteneur = hebergeur;
Peau me = this;
jambe1 = new Jambe(hebergeur, ref me, lg, ep/4, Math.PI / 2); jambe2 = new Jambe(hebergeur, ref me, lg, ep / 4, Math.PI / 2); tete = new Tete(hebergeur, ref me, (int)(ep*3.5/4));
bras = new Bras(hebergeur, ref me, lg, ep/4, Math.PI / 2);
}
public Bonhomme(ref PictureBox hebergeur, ref Peau parent, double lg, double ep, double angle) : base( hebergeur, ref parent, lg, ep, angle)
{
this.conteneur = hebergeur;
}
public new void Afficher(IntPtr handle)
{
base.Afficher(handle);
tete.Afficher(handle);
jambe1.Afficher(handle);
jambe2.Afficher(handle);
bras.Afficher(handle);
}
public new void Afficher(Graphics gr)
{
base.Afficher(gr);
tete.Afficher(gr);
jambe1.Afficher(gr);
jambe2.Afficher(gr);
bras.Afficher(gr);
}
public void Afficher()
{
Afficher(conteneur.Handle);
}
public new void Cacher(Graphics gr)
{
base.Cacher(gr);
tete.Cacher(gr);
jambe1.Cacher(gr);
jambe2.Cacher(gr);
bras.Cacher(gr);
}
public void Cacher()
{
Cacher(conteneur.Handle);
}
public void InterevrtirJambe()
{
Jambe tmp;
tmp = jambe1;
jambe1 = jambe2;
jambe2 = tmp;
}
}
}