Salut,
j'ai ce code la:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Timers;
 
namespace MultiThing
{
    public partial class FSplash : Form
    {
        public Thread chargementFonction;
        private delegate void Afficher(string str, int charg);
 
        public FSplash()
        {
            InitializeComponent();
            chargementFonction = new Thread(chargement);
            chargementFonction.Start();
        }
 
        public void chargement()
        {
            if (!this.IsHandleCreated) { this.CreateHandle(); }
 
            this.Invoke(new Afficher(Affichertext), "Chargement des librairies...", 0);
            Thread.Sleep(2000);
            this.Invoke(new Afficher(Affichertext), "Chargement des fichiers...", 20);
            Thread.Sleep(2000);
            this.Invoke(new Afficher(Affichertext), "Chargement des plugins...", 40);
            Thread.Sleep(2000);
            this.Invoke(new Afficher(Affichertext), "Chargement des préférences utilisateurs...", 60);
            Thread.Sleep(2000);
            this.Invoke(new Afficher(Affichertext), "Mise en cache...", 80);
            Thread.Sleep(2000);
            this.Invoke(new Afficher(Affichertext), "C'est parti !", 100);
            Thread.Sleep(2000);
            chargementFonction.Abort();
        }
 
        public void Affichertext(string str, int charg)
        {
 
            txtLoad.Text = str;
            txtLoad.Refresh();
            barLoad.Value = charg;
        }
    }
}
Et j'aimerai fermer ma form sauf que si je mets this.close(); apres le abort ca ne fait rien, pareil avant et si je le mets après chargementfonction.Start(); ca ferme avant d'avoir chargé et provoque des erreurs :s
j'ai meme essayé ca:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
            while (!Thread.CurrentThread.IsAlive)
            {
                this.Close();
            }
sauf que sa ne fait rien (après le chargementfonction.Start();)
Comment faire ?
Merci d'avance