1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| private void btnouvrir_Click(object sender, EventArgs e)
{
//////////////////////////////////////////////////////////////////////////////////////////
// reinitialisation des variable et rafraîchissement de la picturebox
pictureBox.Refresh();
degrelat = 0;
minuteslat = 0;
degrelong = 0;
minuteslong = 0;
conversionlat = 0;
conversionlong = 0;
affichage = null;
coordon = null;
geodata.Clear();
PICTTBL.Clear();
data = null;
DEBMAX = 0;
DEBMIN = 0;
DMBMAX = 0;
DMBMIN = 0;
DELTADEB = 0;
DELTADMB = 0;
echelleX = 1;
echelleY = 1;
length = 0;
/////////////////////////////////////////////////////////////////////////////////////////
DialogResult reponse = openFileDialog1.ShowDialog() ;
if (reponse == DialogResult.OK)
{
Stream stream = openFileDialog1.OpenFile();
StreamReader lecture = new StreamReader(stream, Encoding.Default);
while (lecture.EndOfStream != true)
{
string ligne = " ";
ligne = lecture.ReadLine();
degrelat = Convert.ToInt32(ligne.Substring(0, 2));
minuteslat = Convert.ToDouble(ligne.Substring(2, 7).Replace('.', ','));
degrelong = Convert.ToInt32(ligne.Substring(10, 3));
minuteslong = Convert.ToDouble(ligne.Substring(13, 7).Replace('.', ','));
affichage = agricoltraits(minuteslong, minuteslat, degrelat, degrelong);
}
stream.Close();
lecture.Close();
}
Graphics g = Graphics.FromHwnd(pictureBox.Handle); //encapsulage d'une surface de dessin , mise en lien
//avec la picturebox
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; //ligne de commande pour lisser la ligne
//graphique tracée
greenpen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; // ligne pour commander l'apparence de la ligne
// permet de convertir la list de points en tableau de point grâce au pen appelé greenpen
g.DrawLines(greenpen, coordon); // la methode drawlines dessine un segment d'un tableau
g.Dispose(); // pour ne pas occuper de la memoire pour rien.
} |
Partager