bonhomeExamJanvier/Bonhomme02/Tete.cs

57 lines
1.6 KiB
C#

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 Tete : BaseDessin
{
public int rayon;
Peau corp;
public Tete() : base()
{
}
public Tete(PictureBox hebergeur, ref Peau corp, int rayon) : base(hebergeur)
{
this.rayon = rayon;
this.corp = corp;
}
public void Cacher(IntPtr handle)
{
Point posi = new Point(corp.coordonnee.X - rayon, corp.coordonnee.Y - rayon * 2);
if (base.Visible)
{
Graphics gr = Graphics.FromHwnd(handle);
if (base.Remplir)
{
gr.FillEllipse(new SolidBrush(base.Hebergeur.BackColor), posi.X , posi.Y, rayon*2, rayon*2);
}
gr.DrawEllipse(new Pen(base.Hebergeur.BackColor), posi.X, posi.Y, rayon*2, rayon*2);
}
}
public void Afficher(IntPtr handle)
{
if (base.Visible)
{
Graphics gr = Graphics.FromHwnd(handle);
Point posi = new Point(corp.coordonnee.X - rayon , corp.coordonnee.Y - rayon * 2);
if (base.Remplir)
{
gr.FillEllipse(new SolidBrush(Color.Blue), posi.X, posi.Y, rayon * 2, rayon * 2);
}
gr.DrawEllipse(new Pen(Brushes.Black), posi.X, posi.Y, rayon * 2, rayon * 2);
}
}
}
}