ProgressBar.Value, propriété (System.Windows.Forms)

Bibliothèque de classes .NET Framework 
ProgressBar.Value, propriété 

Obtient ou définit la position actuelle de la barre de progression.

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

SyntaxeSyntaxe


Visual Basic (Déclaration)
<BindableAttribute(True)> _
Public Property Value As Integer


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

value = instance.Value

instance.Value = value


C#
[BindableAttribute(true)] 
public int Value { get; set; }


C++
[BindableAttribute(true)] 
public:
property int Value {
    int get ();
    void set (int value);
}


J#
/** @property */
public int get_Value ()

/** @property */
public void set_Value (int value)


JScript
public function get Value () : int

public function set Value (value : int)

Valeur de la propriété

Position dans la plage de la barre de progression. La valeur par défaut est 0.
ExceptionsExceptions
Type d'exceptionCondition

ArgumentException

La valeur spécifiée est supérieure à la valeur de la propriété Maximum.

- ou -

La valeur spécifiée est inférieure à la valeur de la propriété Minimum.

NotesNotes

Les valeurs minimale et maximale de la propriété Value sont spécifiées par les propriétés Minimum et Maximum. La propriété vous permet d'incrémenter ou de décrémenter directement la valeur de la barre de progression. Pour effectuer des augmentations constantes de la valeur du contrôle ProgressBar vous pouvez utiliser la propriété Step avec la méthode PerformStep. Pour augmenter la valeur de la barre de progression de quantités variables, utilisez la méthode Increment.

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

.NET Compact Framework

Prise en charge dans : 2.0, 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.value.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-6036
Document créé le 30/10/06 01:58, dernière modification le Vendredi 17 Juin 2011, 12:11
Source du document imprimé : http://www.gaudry.be/dotnet-rf-system.windows.forms.progressbar.value.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,45 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Il n'y a point de génie sans un grain de folie.

Aristote
 
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)