Freigeben über


NumericUpDown.Minimum-Eigenschaft

Ruft den kleinsten zulässigen Wert für das Drehfeld (auch als Auf-Ab-Steuerelement bezeichnet) ab oder legt diesen fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Property Minimum As Decimal
'Usage
Dim instance As NumericUpDown
Dim value As Decimal

value = instance.Minimum

instance.Minimum = value
public decimal Minimum { get; set; }
public:
property Decimal Minimum {
    Decimal get ();
    void set (Decimal value);
}
/** @property */
public Decimal get_Minimum ()

/** @property */
public void set_Minimum (Decimal value)
public function get Minimum () : decimal

public function set Minimum (value : decimal)

Eigenschaftenwert

Der kleinste zulässige Wert für das Drehfeld. Der Standardwert ist 0.

Hinweise

Wenn die Minimum-Eigenschaft festgelegt wurde, wird die Maximum-Eigenschaft ausgewertet und die UpdateEditText-Methode aufgerufen. Wenn der neue Minimum-Eigenschaftenwert größer ist als der Maximum-Eigenschaftenwert, wird der Maximum-Wert mit dem Minimum-Wert gleichgesetzt. Wenn Value kleiner ist als der neue Minimum-Wert, wird die Value-Eigenschaft ebenfalls mit dem Minimum-Wert gleichgesetzt.

Beispiel

Im folgenden Codebeispiel wird ein NumericUpDown-Steuerelement erstellt und initialisiert, wobei einige seiner allgemeinen Eigenschaften festgelegt werden. Außerdem wird es Benutzern ermöglicht, einige dieser Eigenschaften zur Laufzeit zu ändern. In diesem Code wird davon ausgegangen, dass in einem Formular drei CheckBox-Steuerelemente platziert und Handler für die Click-Ereignisse instanziiert wurden. Die DecimalPlaces-Eigenschaft, die ThousandsSeparator-Eigenschaft und die Hexadecimal-Eigenschaft werden im Click-Ereignis der einzelnen Kontrollkästchen festgelegt.

Public Sub InstantiateMyNumericUpDown()
    ' Create and initialize a NumericUpDown control.
    numericUpDown1 = New NumericUpDown()
    
    ' Dock the control to the top of the form.
    numericUpDown1.Dock = System.Windows.Forms.DockStyle.Top
    
    ' Set the Minimum, Maximum, and initial Value.
    numericUpDown1.Value = 5
    numericUpDown1.Maximum = 2500
    numericUpDown1.Minimum = - 100
    
    ' Add the NumericUpDown to the Form.
    Controls.Add(numericUpDown1)
End Sub    

' Check box to toggle decimal places to be displayed.
Private Sub checkBox1_Click(sender As Object, e As EventArgs)
    ' If DecimalPlaces is greater than 0, set them to 0 and round the
    ' current Value; otherwise, set DecimalPlaces to 2 and change the
    ' Increment to 0.25. 
    If numericUpDown1.DecimalPlaces > 0 Then
        numericUpDown1.DecimalPlaces = 0
        numericUpDown1.Value = Decimal.Round(numericUpDown1.Value, 0)
    Else
        numericUpDown1.DecimalPlaces = 2
        numericUpDown1.Increment = 0.25D
    End If
End Sub    

' Check box to toggle thousands separators to be displayed.
Private Sub checkBox2_Click(sender As Object, e As EventArgs)
    ' If ThousandsSeparator is true, set it to false;
    ' otherwise, set it to true. 
    If numericUpDown1.ThousandsSeparator Then
        numericUpDown1.ThousandsSeparator = False
    Else
        numericUpDown1.ThousandsSeparator = True
    End If
End Sub    

' Check box to toggle hexadecimal to be displayed.
Private Sub checkBox3_Click(sender As Object, e As EventArgs)
    ' If Hexadecimal is true, set it to false;
    ' otherwise, set it to true. 
    If numericUpDown1.Hexadecimal Then
        numericUpDown1.Hexadecimal = False
    Else
        numericUpDown1.Hexadecimal = True
    End If
End Sub
public void InstantiateMyNumericUpDown()
{
   // Create and initialize a NumericUpDown control.
   numericUpDown1 = new NumericUpDown();

   // Dock the control to the top of the form.
   numericUpDown1.Dock = System.Windows.Forms.DockStyle.Top;

   // Set the Minimum, Maximum, and initial Value.
   numericUpDown1.Value = 5;
   numericUpDown1.Maximum = 2500;
   numericUpDown1.Minimum = -100;
   
   // Add the NumericUpDown to the Form.
   Controls.Add(numericUpDown1);
}

// Check box to toggle decimal places to be displayed.
private void checkBox1_Click(Object sender,
                             EventArgs e)
{
   /* If DecimalPlaces is greater than 0, set them to 0 and round the 
      current Value; otherwise, set DecimalPlaces to 2 and change the 
      Increment to 0.25. */
   if (numericUpDown1.DecimalPlaces > 0)
   {
      numericUpDown1.DecimalPlaces = 0;
      numericUpDown1.Value = Decimal.Round(numericUpDown1.Value, 0);
   }
   else
   {
      numericUpDown1.DecimalPlaces = 2;
      numericUpDown1.Increment = 0.25M;
   }
}

// Check box to toggle thousands separators to be displayed.
private void checkBox2_Click(Object sender,
                             EventArgs e)
{   
   /* If ThousandsSeparator is true, set it to false; 
      otherwise, set it to true. */
   if (numericUpDown1.ThousandsSeparator)
   {
      numericUpDown1.ThousandsSeparator = false;
   }
   else
   {
      numericUpDown1.ThousandsSeparator = true;
   }
}

// Check box to toggle hexadecimal to be displayed.
private void checkBox3_Click(Object sender, 
                             EventArgs e)
{
   /* If Hexadecimal is true, set it to false; 
      otherwise, set it to true. */    
   if (numericUpDown1.Hexadecimal)
   {
      numericUpDown1.Hexadecimal = false;
   }
   else
   {
      numericUpDown1.Hexadecimal = true;
   }
}
public:
   void InstantiateMyNumericUpDown()
   {
      // Create and initialize a NumericUpDown control.
      numericUpDown1 = gcnew NumericUpDown;
      
      // Dock the control to the top of the form.
      numericUpDown1->Dock = System::Windows::Forms::DockStyle::Top;
      
      // Set the Minimum, Maximum, and initial Value.
      numericUpDown1->Value = 5;
      numericUpDown1->Maximum = 2500;
      numericUpDown1->Minimum = -100;
      
      // Add the NumericUpDown to the Form.
      Controls->Add( numericUpDown1 );
   }

private:
   // Check box to toggle decimal places to be displayed.
   void checkBox1_Click( Object^ sender, EventArgs^ e )
   {
      /* If DecimalPlaces is greater than 0, set them to 0 and round the 
         current Value; otherwise, set DecimalPlaces to 2 and change the 
         Increment to 0.25. */
      if ( numericUpDown1->DecimalPlaces > 0 )
      {
         numericUpDown1->DecimalPlaces = 0;
         numericUpDown1->Value = Decimal::Round( numericUpDown1->Value, 0 );
      }
      else
      {
         numericUpDown1->DecimalPlaces = 2;
         numericUpDown1->Increment = Decimal(0.25);
      }
   }

   // Check box to toggle thousands separators to be displayed.
   void checkBox2_Click( Object^ sender, EventArgs^ e )
   {
      /* If ThousandsSeparator is true, set it to false; 
         otherwise, set it to true. */
      if ( numericUpDown1->ThousandsSeparator )
      {
         numericUpDown1->ThousandsSeparator = false;
      }
      else
      {
         numericUpDown1->ThousandsSeparator = true;
      }
   }

   // Check box to toggle hexadecimal to be displayed.
   void checkBox3_Click( Object^ sender, EventArgs^ e )
   {
      /* If Hexadecimal is true, set it to false; 
         otherwise, set it to true. */
      if ( numericUpDown1->Hexadecimal )
      {
         numericUpDown1->Hexadecimal = false;
      }
      else
      {
         numericUpDown1->Hexadecimal = true;
      }
   }
public void InstantiateMyNumericUpDown()
{
    // Create and initialize a NumericUpDown control.
    numericUpDown1 = new NumericUpDown();

    // Dock the control to the top of the form.
    numericUpDown1.set_Dock(System.Windows.Forms.DockStyle.Top);

    // Set the Minimum, Maximum, and initial Value.
    numericUpDown1.set_Value(System.Convert.ToDecimal(5));
    numericUpDown1.set_Maximum(System.Convert.ToDecimal(2500));
    numericUpDown1.set_Minimum(System.Convert.ToDecimal(-100));

    // Add the NumericUpDown to the Form.
    get_Controls().Add(numericUpDown1);
} //InstantiateMyNumericUpDown

// Check box to toggle decimal places to be displayed.
private void checkBox1_Click(Object sender,EventArgs e)
{
    /*  If DecimalPlaces is greater than 0, set them to 0 and round the 
        current Value; otherwise, set DecimalPlaces to 2 and change the 
        Increment to 0.25.
     */
    if (numericUpDown1.get_DecimalPlaces() > 0) {
        numericUpDown1.set_DecimalPlaces(0);
        numericUpDown1.set_Value(Decimal.Round
            (numericUpDown1.get_Value(), 0));
    }
    else {
        numericUpDown1.set_DecimalPlaces(2);
        numericUpDown1.set_Increment(System.Convert.ToDecimal((0.25)));
    }
} //checkBox1_Click

// Check box to toggle thousands separators to be displayed.
private void checkBox2_Click(Object sender,EventArgs e)
{
    /* If ThousandsSeparator is true, set it to false; 
       otherwise, set it to true.
     */
    if (numericUpDown1.get_ThousandsSeparator()) {
        numericUpDown1.set_ThousandsSeparator(false);
    }
    else {
        numericUpDown1.set_ThousandsSeparator(true);
    }
} //checkBox2_Click

// Check box to toggle hexadecimal to be displayed.
private void checkBox3_Click(Object sender,EventArgs e)
{
    /* If Hexadecimal is true, set it to false; 
       otherwise, set it to true. 
     */
    if (numericUpDown1.get_Hexadecimal()) {
        numericUpDown1.set_Hexadecimal(false);
    }
    else {
        numericUpDown1.set_Hexadecimal(true);
    }
} //checkBox3_Click
function InstantiateMyNumericUpDown(){
  // Create and initialize a NumericUpDown control.
  numericUpDown1 = new NumericUpDown()
  
  // Dock the control to the top of the form.
  numericUpDown1.Dock = System.Windows.Forms.DockStyle.Top
  
  // Set the Minimum, Maximum, and initial Value.
  numericUpDown1.Value = 5
  numericUpDown1.Maximum = 2500
  numericUpDown1.Minimum = - 100
  
  // Add the NumericUpDown to the Form.
  Controls.Add(numericUpDown1)
}    

// Check box to toggle decimal places to be displayed.
function checkBox1_Click(sender : Object, e : EventArgs){
  // If DecimalPlaces is greater than 0, set them to 0 and round the
  // current Value; otherwise, set DecimalPlaces to 2 and change the
  // Increment to 0.25. 
  if(numericUpDown1.DecimalPlaces > 0){
    numericUpDown1.DecimalPlaces = 0
    numericUpDown1.Value = Decimal.Round(numericUpDown1.Value, 0)
  }else{
    numericUpDown1.DecimalPlaces = 2
    numericUpDown1.Increment = 0.25
  }
}    

// Check box to toggle thousands separators to be displayed.
function checkBox2_Click(sender : Object, e : EventArgs){
  // If ThousandsSeparator is true, set it to false;
  // otherwise, set it to true. 
  numericUpDown1.ThousandsSeparator = !numericUpDown1.ThousandsSeparator
}    

// Check box to toggle hexadecimal to be displayed.
function checkBox3_Click(sender : Object, e : EventArgs){
  // If Hexadecimal is true, set it to false;
  // otherwise, set it to true. 
  numericUpDown1.Hexadecimal = !numericUpDown1.Hexadecimal
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

NumericUpDown-Klasse
NumericUpDown-Member
System.Windows.Forms-Namespace
NumericUpDown.Increment-Eigenschaft
NumericUpDown.Maximum-Eigenschaft
UpdateEditText