ProgressBar.Increment, méthode (System.Windows.Forms)

Bibliothèque de classes .NET Framework 
ProgressBar.Increment, méthode 

Fait avancer la position actuelle de la barre de progression de la quantité spécifiée.

Espace de noms : System.Windows.Forms
Assembly : System.Windows.Forms (dans system.windows.forms.dll)

SyntaxeSyntaxe


Visual Basic (Déclaration)
Public Sub Increment ( _
    value As Integer _
)


Visual Basic (Utilisation)
Dim instance As ProgressBar
Dim value As Integer

instance.Increment(value)


C#
public void Increment (
    int value
)


C++
public:
void Increment (
    int value
)


J#
public void Increment (
    int value
)


JScript
public function Increment (
    value : int
)

Paramètres

value

Quantité d'incrémentation de la position actuelle de la barre de progression.

ExceptionsExceptions
Type d'exceptionCondition

InvalidOperationException

La propriété Style a la valeur Marquee.

NotesNotes

La méthode Increment vous permet d'incrémenter la valeur de la barre de progression d'une quantité spécifique. Cette méthode d'incrémentation de la barre de progression est analogue à l'utilisation de la propriété Step avec la méthode PerformStep. La propriété Value spécifie la position actuelle de ProgressBar. Si, après l'appel la méthode Increment, la propriété Value est supérieure à la valeur de la propriété Maximum, la valeur attribuée à la propriété Value reste celle de la propriété Maximum. Si, après l'appel à la méthode Increment avec une valeur négative spécifiée dans le paramètre value, la propriété Value est inférieure à la valeur de la propriété Minimum, la valeur attribuée à la propriété Value reste celle de la propriété Minimum.

ExempleExemple

L'exemple de code suivant illustre comment utiliser la méthode Increment et la propriété Value pour incrémenter la valeur de ProgressBar dans l'événement Tick de Timer. L'exemple affiche également la propriété Value dans StatusBarPanel afin de fournir une représentation textuelle de ProgressBar. Cet exemple suppose que vous disposez d'un contrôle ProgressBar, nommé progressBar1 et un contrôle StatusBar qui contient StatusBarPanel, nommé statusBarPanel1. Timer, nommé time, doit être ajouté au formulaire en tant que membre.



Visual Basic
Private time As New Timer()

' Call this method from the constructor of the form.
Private Sub InitializeMyTimer()
   ' Set the interval for the timer.
   time.Interval = 250
   ' Connect the Tick event of the timer to its event handler.
   AddHandler time.Tick, AddressOf IncreaseProgressBar
   ' Start the timer.
   time.Start()
End Sub


Private Sub IncreaseProgressBar(ByVal sender As Object, ByVal e As EventArgs)
   ' Increment the value of the ProgressBar a value of one each time.
   ProgressBar1.Increment(1)
   ' Display the textual value of the ProgressBar in the StatusBar control's first panel.
   statusBarPanel1.Text = ProgressBar1.Value.ToString() + "% Completed"
   ' Determine if we have completed by comparing the value of the Value property to the Maximum value.
   If ProgressBar1.Value = ProgressBar1.Maximum Then
      ' Stop the timer.
      time.Stop()
   End If
End Sub


C#
private Timer time = new Timer();

// Call this method from the constructor of the form.
private void InitializeMyTimer()
{
   // Set the interval for the timer.
   time.Interval = 250;
   // Connect the Tick event of the timer to its event handler.
   time.Tick += new EventHandler(IncreaseProgressBar);
   // Start the timer.
   time.Start();
}

private void IncreaseProgressBar(object sender, EventArgs e)
{
   // Increment the value of the ProgressBar a value of one each time.
   progressBar1.Increment(1);
   // Display the textual value of the ProgressBar in the StatusBar control's first panel.
   statusBarPanel1.Text = progressBar1.Value.ToString() + "% Completed";
   // Determine if we have completed by comparing the value of the Value property to the Maximum value.
   if (progressBar1.Value == progressBar1.Maximum)
      // Stop the timer.
      time.Stop();
}


C++
private:
   Timer^ time;

   // Call this method from the constructor of the form.
   void InitializeMyTimer()
   {
      // Set the interval for the timer.
      time->Interval = 250;

      // Connect the Tick event of the timer to its event handler.
      time->Tick += gcnew EventHandler( this, &Form1::IncreaseProgressBar );

      // Start the timer.
      time->Start();
   }

   void IncreaseProgressBar( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      // Increment the value of the ProgressBar a value of one each time.
      progressBar1->Increment( 1 );

      // Display the textual value of the ProgressBar in the StatusBar control's first panel.
      statusBarPanel1->Text = String::Concat( progressBar1->Value, "% Completed" );

      // Determine if we have completed by comparing the value of the Value property to the Maximum value.
      if ( progressBar1->Value == progressBar1->Maximum )

      // Stop the timer.
      time->Stop();
   }


J#
private Timer time = new Timer();

// Call this method from the constructor of the form.
private void InitializeMyTimer()
{
    // Set the interval for the timer.
    time.set_Interval(250);
    // Connect the Tick event of the timer to its event handler.
    time.add_Tick(new EventHandler(IncreaseProgressBar));
    // Start the timer.
    time.Start();
} //InitializeMyTimer

private void IncreaseProgressBar(Object sender, EventArgs e)
{
    // Increment the value of the ProgressBar a value of one each time.
    progressBar1.Increment(1);
    // Display the textual value of the ProgressBar in the StatusBar
    // control's first panel.
    statusBarPanel1.set_Text(progressBar1.get_Value() + "% Completed");
    // Determine if we have completed by comparing the value of the Value
    // property to the Maximum value.
    if (progressBar1.get_Value() == progressBar1.get_Maximum()) {
        // Stop the timer.
        time.Stop();
    }        
} //IncreaseProgressBar
Plates-formesPlates-formes

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition

Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.

Informations de versionInformations de version

.NET Framework

Prise en charge dans : 2.0, 1.1, 1.0
Voir aussiVoir aussi

Ces informations proviennent du site de http://msdn2.microsoft.com
Source de cette page : http://msdn2.microsoft.com/fr-fr/library/system.windows.forms.progressbar.increment.aspx

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

10 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-6403
Document créé le 30/10/06 03:19, dernière modification le Vendredi 17 Juin 2011, 12:11
Source du document imprimé : http://www.gaudry.be/dotnet-rf-system.windows.forms.progressbar.increment.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,37 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
J'ai inventé une lampe de poche qui fonctionne à l'énergie solaire, elle n'a qu'un dernier défaut, elle ne marche qu'en plein soleil.

Gaston Lagaffe
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 05:43, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)