TrackBar.Maximum 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 TrackBar가 사용되는 범위의 상한을 가져오거나 설정합니다.
public:
property int Maximum { int get(); void set(int value); };
public int Maximum { get; set; }
member this.Maximum : int with get, set
Public Property Maximum As Integer
속성 값
TrackBar의 최대값으로, 기본값은 10입니다.
예제
다음 코드 예제에서는 컨트롤 및 컨트롤을 포함 하는 TrackBar 폼을 표시 합니다 TextBox . 이 예제에서는 , , TickFrequency및 속성을 설정하고 Maximum이벤트를 처리하는 방법을 보여 줍니다Scroll.SmallChangeLargeChange TextBox 이벤트가 발생할 때 콘텐츠가 Value 속성 값으로 Scroll 업데이트됩니다.
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public System::Windows::Forms::Form
{
private:
System::Windows::Forms::TrackBar^ trackBar1;
System::Windows::Forms::TextBox^ textBox1;
public:
Form1()
{
this->textBox1 = gcnew System::Windows::Forms::TextBox;
this->trackBar1 = gcnew System::Windows::Forms::TrackBar;
// TextBox for TrackBar::Value update.
this->textBox1->Location = System::Drawing::Point( 240, 16 );
this->textBox1->Size = System::Drawing::Size( 48, 20 );
// Set up how the form should be displayed and add the controls to the form.
this->ClientSize = System::Drawing::Size( 296, 62 );
array<System::Windows::Forms::Control^>^formControls = {this->textBox1,this->trackBar1};
this->Controls->AddRange( formControls );
this->Text = "TrackBar Example";
// Set up the TrackBar.
this->trackBar1->Location = System::Drawing::Point( 8, 8 );
this->trackBar1->Size = System::Drawing::Size( 224, 45 );
this->trackBar1->Scroll += gcnew System::EventHandler( this, &Form1::trackBar1_Scroll );
// The Maximum property sets the value of the track bar when
// the slider is all the way to the right.
trackBar1->Maximum = 30;
// The TickFrequency property establishes how many positions
// are between each tick-mark.
trackBar1->TickFrequency = 5;
// The LargeChange property sets how many positions to move
// if the bar is clicked on either side of the slider.
trackBar1->LargeChange = 3;
// The SmallChange property sets how many positions to move
// if the keyboard arrows are used to move the slider.
trackBar1->SmallChange = 2;
}
private:
void trackBar1_Scroll( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
// Display the trackbar value in the text box.
textBox1->Text = String::Concat( "", trackBar1->Value );
}
};
[STAThread]
int main()
{
Application::Run( gcnew Form1 );
}
using System;
using System.Drawing;
using System.Windows.Forms;
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TrackBar trackBar1;
private System.Windows.Forms.TextBox textBox1;
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public Form1()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.trackBar1 = new System.Windows.Forms.TrackBar();
// TextBox for TrackBar.Value update.
this.textBox1.Location = new System.Drawing.Point(240, 16);
this.textBox1.Size = new System.Drawing.Size(48, 20);
// Set up how the form should be displayed and add the controls to the form.
this.ClientSize = new System.Drawing.Size(296, 62);
this.Controls.AddRange(new System.Windows.Forms.Control[] {this.textBox1,this.trackBar1});
this.Text = "TrackBar Example";
// Set up the TrackBar.
this.trackBar1.Location = new System.Drawing.Point(8, 8);
this.trackBar1.Size = new System.Drawing.Size(224, 45);
this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
// The Maximum property sets the value of the track bar when
// the slider is all the way to the right.
trackBar1.Maximum = 30;
// The TickFrequency property establishes how many positions
// are between each tick-mark.
trackBar1.TickFrequency = 5;
// The LargeChange property sets how many positions to move
// if the bar is clicked on either side of the slider.
trackBar1.LargeChange = 3;
// The SmallChange property sets how many positions to move
// if the keyboard arrows are used to move the slider.
trackBar1.SmallChange = 2;
}
private void trackBar1_Scroll(object sender, System.EventArgs e)
{
// Display the trackbar value in the text box.
textBox1.Text = "" + trackBar1.Value;
}
}
Imports System.Drawing
Imports System.Windows.Forms
Public Class Form1
Inherits System.Windows.Forms.Form
Private WithEvents trackBar1 As System.Windows.Forms.TrackBar
Private textBox1 As System.Windows.Forms.TextBox
<System.STAThread()> _
Public Shared Sub Main()
System.Windows.Forms.Application.Run(New Form1)
End Sub
Public Sub New()
Me.textBox1 = New System.Windows.Forms.TextBox
Me.trackBar1 = New System.Windows.Forms.TrackBar
' TextBox for TrackBar.Value update.
Me.textBox1.Location = New System.Drawing.Point(240, 16)
Me.textBox1.Size = New System.Drawing.Size(48, 20)
' Set up how the form should be displayed and add the controls to the form.
Me.ClientSize = New System.Drawing.Size(296, 62)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.textBox1, Me.trackBar1})
Me.Text = "TrackBar Example"
' Set up the TrackBar.
Me.trackBar1.Location = New System.Drawing.Point(8, 8)
Me.trackBar1.Size = New System.Drawing.Size(224, 45)
' The Maximum property sets the value of the track bar when
' the slider is all the way to the right.
trackBar1.Maximum = 30
' The TickFrequency property establishes how many positions
' are between each tick-mark.
trackBar1.TickFrequency = 5
' The LargeChange property sets how many positions to move
' if the bar is clicked on either side of the slider.
trackBar1.LargeChange = 3
' The SmallChange property sets how many positions to move
' if the keyboard arrows are used to move the slider.
trackBar1.SmallChange = 2
End Sub
Private Sub trackBar1_Scroll(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles trackBar1.Scroll
' Display the trackbar value in the text box.
textBox1.Text = trackBar1.Value
End Sub
End Class
설명
메서드를 SetRange 사용하여 및 Minimum 속성을 동시에 설정할 Maximum 수 있습니다.
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET