Bonjour comment lancer l'attente d'un programme ou lancer un traitement assez long sans freezer mon application !

impossible lors du sleep de deplacer mon application, de la reduire etc....

merci d'avance

voila mon code simple, on click sur un bouton qui lance un sleep, ou bien une boucle de 1 à 1000000, impossible durant le traitement de deplacer la form

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
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;
 
namespace TestPause1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void btnENVOYER_Click(object sender, EventArgs e)
        {
            WaitTime(10);
        }
 
 
 
 
        private void WaitTime(int attendre)
        {
            while (0 < attendre)
            {
                System.Threading.Thread.Sleep(1000); // 1 secondes 1000
                attendre = attendre - 1;
                //lblATT.Text = SIMNLib.cFonctions.RightChaine(string.Format("  {0}  ", att), 5);
                //lblATT.Refresh();
 
            }
 
        }
    }
}