bonhomeExamJanvier/Bonhomme02/BaseDessin.cs

110 lines
2.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 BaseDessin
{
#region Données membres
private bool _Visible = true;
private PictureBox _Hebergeur;
private Color _Fond = Color.Blue;
private Color _Crayon = Color.Black;
private Boolean remplir = true;
public double eppaisseurContour = 5;
#endregion
#region Constructeurs
public BaseDessin()
{
this._Hebergeur = null;
}
public BaseDessin(PictureBox hebergeur)
{
this._Hebergeur = hebergeur;
}
public BaseDessin(PictureBox hebergeur, Color crayon, Color Fond) : this(hebergeur)
{
Crayon = crayon;
this.Fond = Fond;
}
#endregion
#region Accesseurs
public bool Visible
{
get { return _Visible; }
set { _Visible = value; }
}
public bool Remplir
{
get { return remplir; }
set { remplir = value; }
}
public Color Fond
{
get { return _Fond; }
set
{
try { _Fond = value; }
catch (Exception e) { Console.WriteLine("Erreur couleur invalide : " + e.ToString());}
}
}
public Color Crayon
{
get { return _Crayon; }
set
{
try { _Crayon = value; }
catch (Exception e) { Console.WriteLine("Erreur couleur invalide : " + e.ToString()); }
}
}
public PictureBox Hebergeur
{
get { return _Hebergeur; }
set { _Hebergeur = value; }
}
#endregion
#region Méthodes
/* 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
}
}