2018-01-03 13:18:01 +01:00
|
|
|
|
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 Peau : BaseDessin
|
|
|
|
|
{
|
2018-01-04 11:34:30 +01:00
|
|
|
|
public Vecteur epaisseur;
|
|
|
|
|
public Vecteur longueur;
|
|
|
|
|
public Peau parent = null;
|
2018-01-03 13:18:01 +01:00
|
|
|
|
public Peau() : base()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Peau(PictureBox hebergeur) : base(hebergeur)
|
|
|
|
|
{
|
|
|
|
|
}
|
2018-01-04 14:03:06 +01:00
|
|
|
|
public Peau(PictureBox hebergeur, double lg, double ep, double angle) : base(hebergeur)
|
|
|
|
|
{
|
|
|
|
|
InitVecteurs(lg, ep, angle);
|
|
|
|
|
}
|
2018-01-03 13:18:01 +01:00
|
|
|
|
public Peau(PictureBox hebergeur, int xy) : base(hebergeur, xy)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 11:34:30 +01:00
|
|
|
|
public Peau(PictureBox hebergeur, int x, int y, double lg, double ep, double angle) : base(hebergeur, x, y)
|
2018-01-03 13:18:01 +01:00
|
|
|
|
{
|
|
|
|
|
InitVecteurs(lg, ep, angle);
|
|
|
|
|
}
|
2018-01-04 11:34:30 +01:00
|
|
|
|
public Peau(PictureBox hebergeur, ref Peau parent, double lg, double ep, double angle) : base(hebergeur, parent.coordonnee.X, parent.coordonnee.Y)
|
|
|
|
|
{
|
|
|
|
|
this.parent = parent;
|
|
|
|
|
InitVecteurs(lg, ep, angle);
|
|
|
|
|
}
|
2018-01-03 13:18:01 +01:00
|
|
|
|
public Peau(int x, int y) : base(x, y)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public Peau(PictureBox hebergeur, int xy, Color crayon) : base(hebergeur, xy, crayon)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Peau(PictureBox hebergeur, int x, int y, Color crayon) : base(hebergeur, x, y, crayon)
|
|
|
|
|
{
|
|
|
|
|
}
|
2018-01-04 11:34:30 +01:00
|
|
|
|
/*(0;0)
|
|
|
|
|
* #---------------------------------------->x
|
|
|
|
|
* | Coordonee
|
|
|
|
|
* | CIG | CID
|
|
|
|
|
* | #********#********#
|
|
|
|
|
* | *<-------|------->*
|
|
|
|
|
* | * -epai. |epaiseur*
|
|
|
|
|
* | * l| *
|
|
|
|
|
* | * o| *
|
|
|
|
|
* | * n| *
|
|
|
|
|
* | * g| *
|
|
|
|
|
* | * u| *
|
|
|
|
|
* | * e| *
|
|
|
|
|
* | * u| *
|
|
|
|
|
* | * r| *
|
|
|
|
|
* | * \/ *
|
|
|
|
|
* | #*****************#
|
|
|
|
|
* | CSG CSD
|
|
|
|
|
* |
|
|
|
|
|
* \/
|
|
|
|
|
* y
|
|
|
|
|
*/
|
2018-01-03 13:18:01 +01:00
|
|
|
|
#region accesseur
|
2018-01-04 11:34:30 +01:00
|
|
|
|
|
|
|
|
|
public Point Coordonnee
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (parent != null)
|
|
|
|
|
{
|
2018-01-04 14:03:06 +01:00
|
|
|
|
return parent.Coordonnee+parent.longueur;
|
2018-01-04 11:34:30 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return base.coordonnee;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-04 14:03:06 +01:00
|
|
|
|
|
2018-01-04 11:34:30 +01:00
|
|
|
|
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; }}
|
|
|
|
|
public virtual Point CSD{ get{ return (Coordonnee + epaisseur) + longueur; }}
|
2018-01-03 13:18:01 +01:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region methode
|
|
|
|
|
private void InitVecteurs(double lg, double ep, double angle)
|
|
|
|
|
{
|
|
|
|
|
this.longueur = new Vecteur(lg, angle);
|
|
|
|
|
this.epaisseur = new Vecteur(ep, ref this.longueur, true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Afficher(IntPtr handle)
|
|
|
|
|
{
|
|
|
|
|
if(base.Visible)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Graphics gr = Graphics.FromHwnd(handle);
|
|
|
|
|
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
|
2018-01-04 11:34:30 +01:00
|
|
|
|
if (base.Remplir )
|
2018-01-03 13:18:01 +01:00
|
|
|
|
{
|
2018-01-04 11:34:30 +01:00
|
|
|
|
gr.FillClosedCurve(new SolidBrush(Color.Blue), l);
|
2018-01-03 13:18:01 +01:00
|
|
|
|
}
|
2018-01-04 11:34:30 +01:00
|
|
|
|
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
|
2018-01-03 13:18:01 +01:00
|
|
|
|
}
|
|
|
|
|
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);
|
2018-01-04 11:34:30 +01:00
|
|
|
|
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
|
2018-01-03 13:18:01 +01:00
|
|
|
|
if (base.Remplir)
|
|
|
|
|
{
|
|
|
|
|
gr.FillClosedCurve(new SolidBrush(base.Fond), l);
|
|
|
|
|
}
|
|
|
|
|
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|