Test vecteur et peau Ok
This commit is contained in:
parent
b1837b43da
commit
92ae4e9524
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27004.2002
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonhomme02", "Bonhomme02\Bonhomme02.csproj", "{B3C7D374-80DA-45F0-B97F-6320169C1BE7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B3C7D374-80DA-45F0-B97F-6320169C1BE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C53F0596-CB41-43D0-97DF-706218E42504}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Base des objets Bras et jambe
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class BaseBJ
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
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
|
||||
public Point coordonnee; // Les coordonée du point seront basé sur le millieux des dessin pour facilité les rotations !
|
||||
private bool _Visible = true;
|
||||
private PictureBox _Hebergeur;
|
||||
private Color _Fond = Color.Silver;
|
||||
private Color _Crayon = Color.Black;
|
||||
private Boolean remplir = true;
|
||||
public double eppaisseurContour = 5;
|
||||
#endregion
|
||||
|
||||
#region Constructeurs
|
||||
public BaseDessin()
|
||||
{
|
||||
this._Hebergeur = null;
|
||||
coordonnee = new Point();
|
||||
}
|
||||
|
||||
public BaseDessin(PictureBox hebergeur)
|
||||
{
|
||||
this._Hebergeur = hebergeur;
|
||||
this._Fond = hebergeur.BackColor;
|
||||
}
|
||||
|
||||
public BaseDessin(PictureBox hebergeur, int xy) : this (hebergeur)
|
||||
{
|
||||
this.coordonnee = new Point(xy, xy);
|
||||
}
|
||||
|
||||
public BaseDessin(PictureBox hebergeur, int x, int y) : this(hebergeur)
|
||||
{
|
||||
this.coordonnee = new Point(x, x);
|
||||
}
|
||||
public BaseDessin(int x, int y)
|
||||
{
|
||||
this.coordonnee = new Point(x, x);
|
||||
}
|
||||
public BaseDessin(PictureBox hebergeur, int xy, Color crayon) : this(hebergeur, xy)
|
||||
{
|
||||
Crayon = crayon;
|
||||
}
|
||||
|
||||
public BaseDessin(PictureBox hebergeur, int x, int y, Color crayon) : this(hebergeur, x, y)
|
||||
{
|
||||
Crayon = crayon;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Accesseurs
|
||||
public int X
|
||||
{
|
||||
get { return coordonnee.X; }
|
||||
set
|
||||
{
|
||||
if (value < 0) { coordonnee.X = 0; }
|
||||
else if (value > this._Hebergeur.Bounds.Size.Width) { coordonnee.X = this._Hebergeur.Bounds.Size.Width; }
|
||||
else { coordonnee.X = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public int Y
|
||||
{
|
||||
get { return coordonnee.Y; }
|
||||
set
|
||||
{
|
||||
if (value < 0) { coordonnee.Y = 0; }
|
||||
else if (value > coordonnee.Y) { coordonnee.Y = this._Hebergeur.Bounds.Size.Height; }
|
||||
else { coordonnee.Y = value; }
|
||||
}
|
||||
}
|
||||
|
||||
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 void Bouger(int deplX, int deplY)
|
||||
{
|
||||
X += deplX;
|
||||
Y += deplY;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class Bonhomme : Peau
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B3C7D374-80DA-45F0-B97F-6320169C1BE7}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Bonhomme02</RootNamespace>
|
||||
<AssemblyName>Bonhomme02</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseBJ.cs" />
|
||||
<Compile Include="BaseDessin.cs" />
|
||||
<Compile Include="Vecteur.cs" />
|
||||
<Compile Include="Bonhomme.cs" />
|
||||
<Compile Include="Bras.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Jambe.cs" />
|
||||
<Compile Include="Peau.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Tete.cs" />
|
||||
<Compile Include="Vecteur_.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class Bras : BaseBJ
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
namespace Bonhomme02
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Variable nécessaire au concepteur.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Nettoyage des ressources utilisées.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Code généré par le Concepteur Windows Form
|
||||
|
||||
/// <summary>
|
||||
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
|
||||
/// le contenu de cette méthode avec l'éditeur de code.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.TV = new System.Windows.Forms.PictureBox();
|
||||
this.timerImage = new System.Windows.Forms.Timer(this.components);
|
||||
this.btnEffacer = new System.Windows.Forms.Button();
|
||||
this.btnStopDeplacerCTick = new System.Windows.Forms.Button();
|
||||
this.btnCreationCarrosse = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TV)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TV
|
||||
//
|
||||
this.TV.Location = new System.Drawing.Point(13, 13);
|
||||
this.TV.Name = "TV";
|
||||
this.TV.Size = new System.Drawing.Size(782, 241);
|
||||
this.TV.TabIndex = 0;
|
||||
this.TV.TabStop = false;
|
||||
//
|
||||
// timerImage
|
||||
//
|
||||
this.timerImage.Interval = 500;
|
||||
this.timerImage.Tick += new System.EventHandler(this.timerImage_Tick);
|
||||
//
|
||||
// btnEffacer
|
||||
//
|
||||
this.btnEffacer.Location = new System.Drawing.Point(13, 305);
|
||||
this.btnEffacer.Name = "btnEffacer";
|
||||
this.btnEffacer.Size = new System.Drawing.Size(389, 23);
|
||||
this.btnEffacer.TabIndex = 10;
|
||||
this.btnEffacer.Text = "Effacer Tout";
|
||||
this.btnEffacer.UseVisualStyleBackColor = true;
|
||||
this.btnEffacer.Click += new System.EventHandler(this.btnEffacer_Click);
|
||||
//
|
||||
// btnStopDeplacerCTick
|
||||
//
|
||||
this.btnStopDeplacerCTick.Enabled = false;
|
||||
this.btnStopDeplacerCTick.Location = new System.Drawing.Point(408, 305);
|
||||
this.btnStopDeplacerCTick.Name = "btnStopDeplacerCTick";
|
||||
this.btnStopDeplacerCTick.Size = new System.Drawing.Size(387, 23);
|
||||
this.btnStopDeplacerCTick.TabIndex = 9;
|
||||
this.btnStopDeplacerCTick.Text = "Stop Tick";
|
||||
this.btnStopDeplacerCTick.UseVisualStyleBackColor = true;
|
||||
this.btnStopDeplacerCTick.Click += new System.EventHandler(this.btnStopDeplacerCTick_Click);
|
||||
//
|
||||
// btnCreationCarrosse
|
||||
//
|
||||
this.btnCreationCarrosse.Location = new System.Drawing.Point(13, 276);
|
||||
this.btnCreationCarrosse.Name = "btnCreationCarrosse";
|
||||
this.btnCreationCarrosse.Size = new System.Drawing.Size(782, 23);
|
||||
this.btnCreationCarrosse.TabIndex = 11;
|
||||
this.btnCreationCarrosse.Text = "Creer Carrosse";
|
||||
this.btnCreationCarrosse.UseVisualStyleBackColor = true;
|
||||
this.btnCreationCarrosse.Click += new System.EventHandler(this.btnCreationCarrosse_Click);
|
||||
//
|
||||
// EcranAccueil
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(807, 415);
|
||||
this.Controls.Add(this.btnCreationCarrosse);
|
||||
this.Controls.Add(this.btnEffacer);
|
||||
this.Controls.Add(this.btnStopDeplacerCTick);
|
||||
this.Controls.Add(this.TV);
|
||||
this.Name = "EcranAccueil";
|
||||
this.Text = "Dessins Animés";
|
||||
((System.ComponentModel.ISupportInitialize)(this.TV)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox TV;
|
||||
private System.Windows.Forms.Timer timerImage;
|
||||
private System.Windows.Forms.Button btnEffacer;
|
||||
private System.Windows.Forms.Button btnStopDeplacerCTick;
|
||||
private System.Windows.Forms.Button btnCreationCarrosse;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
private Bonhomme bonhomme;
|
||||
private Peau test;
|
||||
private BufferedGraphics bufferG = null;
|
||||
private Graphics g;
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
// Modification contre le scintillement - Creation d'une mémoire tampon graphique
|
||||
bufferG = BufferedGraphicsManager.Current.Allocate(TV.CreateGraphics(), TV.DisplayRectangle);
|
||||
g = bufferG.Graphics;
|
||||
}
|
||||
|
||||
private void timerImage_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (/*this.bonhomme.Origine.X + this.bonhomme.Lhorizontal >= this.TV.Width*/1==1)
|
||||
{
|
||||
this.timerImage.Stop();
|
||||
this.btnStopDeplacerCTick.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void btnStopDeplacerCTick_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.timerImage.Stop();
|
||||
this.btnStopDeplacerCTick.Enabled = false;
|
||||
}
|
||||
|
||||
private void btnEffacer_Click(object sender, EventArgs e)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(this.TV.Handle);
|
||||
gr.FillRectangle(new SolidBrush(this.TV.BackColor), 0, 0, this.TV.Bounds.Width, this.TV.Bounds.Height);
|
||||
}
|
||||
|
||||
private void btnCreationCarrosse_Click(object sender, EventArgs e)
|
||||
{
|
||||
test = new Peau(this.TV, 80, 80, 10, 10, Math.PI/2);
|
||||
test.Afficher(this.TV.Handle);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class Jambe : BaseBJ
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
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
|
||||
{
|
||||
Vecteur epaisseur;
|
||||
Vecteur longueur;
|
||||
public Peau() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Peau(PictureBox hebergeur) : base(hebergeur)
|
||||
{
|
||||
}
|
||||
|
||||
public Peau(PictureBox hebergeur, int xy) : base(hebergeur, xy)
|
||||
{
|
||||
}
|
||||
|
||||
public Peau(PictureBox hebergeur, int x, int y, double lg, double ep, double angle) : base(hebergeur,x, y)
|
||||
{
|
||||
InitVecteurs(lg, ep, angle);
|
||||
}
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
#region accesseur
|
||||
public Point CIG{ get{ return base.coordonnee - epaisseur; }}
|
||||
public Point CID{ get{ return base.coordonnee + epaisseur; }}
|
||||
public Point CSG{ get{ return (base.coordonnee - epaisseur) + longueur; }}
|
||||
public Point CSD{ get{ return (base.coordonnee + epaisseur) + longueur; }}
|
||||
#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 };
|
||||
if (base.Remplir || 1==1)
|
||||
{
|
||||
try
|
||||
{
|
||||
gr.FillPolygon(new SolidBrush(Color.Blue), l);
|
||||
//gr.FillPolygon
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
gr.DrawPolygon(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] { CSG, CSD, CID, CIG };
|
||||
if (base.Remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(base.Fond), l);
|
||||
}
|
||||
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Point d'entrée principal de l'application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Les informations générales relatives à un assembly dépendent de
|
||||
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
|
||||
// associées à un assembly.
|
||||
[assembly: AssemblyTitle("Bonhomme02")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Bonhomme02")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
|
||||
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
|
||||
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
|
||||
[assembly: Guid("b3c7d374-80da-45f0-b97f-6320169c1be7")]
|
||||
|
||||
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
|
||||
//
|
||||
// Version principale
|
||||
// Version secondaire
|
||||
// Numéro de build
|
||||
// Révision
|
||||
//
|
||||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
||||
// en utilisant '*', comme indiqué ci-dessous :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,71 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Ce code a été généré par un outil.
|
||||
// Version du runtime :4.0.30319.42000
|
||||
//
|
||||
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
|
||||
// le code est régénéré.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Bonhomme02.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
|
||||
/// </summary>
|
||||
// Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
|
||||
// à l'aide d'un outil, tel que ResGen ou Visual Studio.
|
||||
// Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
|
||||
// avec l'option /str ou régénérez votre projet VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bonhomme02.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes
|
||||
/// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -0,0 +1,30 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Bonhomme02.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class Tete
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class Vecteur
|
||||
{
|
||||
#region donnée
|
||||
private Vecteur parent = null;
|
||||
private Complex vecteur;
|
||||
#endregion
|
||||
#region accesseur
|
||||
public double Angle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (parent != null)
|
||||
return parent.Angle - Math.PI/2;
|
||||
else
|
||||
return vecteur.Phase;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (parent != null)
|
||||
Console.WriteLine("Erreur : La définition de l'angle d'un enfant ne peut-être fait !");
|
||||
else
|
||||
vecteur = Complex.FromPolarCoordinates(vecteur.Magnitude, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int X
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)vecteur.Real;
|
||||
}
|
||||
}
|
||||
public int Y
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)vecteur.Imaginary;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region constructeur
|
||||
public Vecteur()
|
||||
{
|
||||
|
||||
}
|
||||
public Vecteur(double longueur, double angle)
|
||||
{
|
||||
vecteur = Complex.FromPolarCoordinates(longueur, angle);
|
||||
}
|
||||
public Vecteur(double longueur, ref Vecteur parent, bool flag) : this(longueur, parent.Angle - Math.PI / 2)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
#region operateur
|
||||
public static explicit operator Point(Vecteur v) // Rsique de perte de précision donc explicit
|
||||
{
|
||||
return new Point(v.X, v.Y);
|
||||
}
|
||||
public static implicit operator Vecteur(Point pt)
|
||||
{
|
||||
Complex c = new Complex(pt.X, pt.Y);
|
||||
return new Vecteur(c.Magnitude, c.Phase);
|
||||
}
|
||||
public static Point operator +(Vecteur v, Point pt)
|
||||
{
|
||||
return new Point(v.X + pt.X, v.Y + pt.Y);
|
||||
}
|
||||
public static Point operator +(Point pt, Vecteur v)
|
||||
{
|
||||
return new Point(v.X + pt.X, v.Y + pt.Y);
|
||||
}
|
||||
public static Point operator -(Vecteur v, Point pt)
|
||||
{
|
||||
return new Point(v.X - pt.X, v.Y - pt.Y);
|
||||
}
|
||||
public static Point operator -(Point pt, Vecteur v)
|
||||
{
|
||||
return new Point(pt.X - v.X, pt.Y - v.Y);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class Vecteur_
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue