ScrollBar.LargeChange Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri vagy beállítja a tulajdonsághoz hozzáadni vagy kivonni kívánt értéket, Value amikor a görgetőmező nagy távolságra van áthelyezve.
public:
property int LargeChange { int get(); void set(int value); };
public int LargeChange { get; set; }
member this.LargeChange : int with get, set
Public Property LargeChange As Integer
Tulajdonság értéke
Numerikus érték. Az alapértelmezett érték 10.
Kivételek
A hozzárendelt érték kisebb, mint 0.
Példák
Az alábbi példa feltételezi, hogy létrehozott egy Form, a PictureBoxFormhozzáfűzendő, majd egy vízszintes HScrollBar és egy függőleges elemet VScrollBar a PictureBox. Ez a példakód egy nagyobb, az ScrollBar osztály áttekintéséhez megadott példa része.
Ebben a példában a tulajdonság a LargeChange méretéhez PictureBoxviszonyítva van beállítva.
A példa futtatásához fel kell vennie a System.Drawing és System.Windows.Forms névterekre mutató hivatkozásokat.
Note
A példa Visual Studio való futtatásával kapcsolatos útmutatásért lásd: A teljes Windows Forms kódpéldák fordítása és futtatása Visual Studio használatával.
public void SetScrollBarValues()
{
//Set the following scrollbar properties:
//Minimum: Set to 0
//SmallChange and LargeChange: Per UI guidelines, these must be set
// relative to the size of the view that the user sees, not to
// the total size including the unseen part. In this example,
// these must be set relative to the picture box, not to the image.
//Maximum: Calculate in steps:
//Step 1: The maximum to scroll is the size of the unseen part.
//Step 2: Add the size of visible scrollbars if necessary.
//Step 3: Add an adjustment factor of ScrollBar.LargeChange.
//Configure the horizontal scrollbar
//---------------------------------------------
if (this.hScrollBar1.Visible)
{
this.hScrollBar1.Minimum = 0;
this.hScrollBar1.SmallChange = this.pictureBox1.Width / 20;
this.hScrollBar1.LargeChange = this.pictureBox1.Width / 10;
this.hScrollBar1.Maximum = this.pictureBox1.Image.Size.Width - pictureBox1.ClientSize.Width; //step 1
if (this.vScrollBar1.Visible) //step 2
{
this.hScrollBar1.Maximum += this.vScrollBar1.Width;
}
this.hScrollBar1.Maximum += this.hScrollBar1.LargeChange; //step 3
}
//Configure the vertical scrollbar
//---------------------------------------------
if (this.vScrollBar1.Visible)
{
this.vScrollBar1.Minimum = 0;
this.vScrollBar1.SmallChange = this.pictureBox1.Height / 20;
this.vScrollBar1.LargeChange = this.pictureBox1.Height / 10;
this.vScrollBar1.Maximum = this.pictureBox1.Image.Size.Height - pictureBox1.ClientSize.Height; //step 1
if (this.hScrollBar1.Visible) //step 2
{
this.vScrollBar1.Maximum += this.hScrollBar1.Height;
}
this.vScrollBar1.Maximum += this.vScrollBar1.LargeChange; //step 3
}
}
Public Sub SetScrollBarValues()
'Set the following scrollbar properties:
'Minimum: Set to 0
'SmallChange and LargeChange: Per UI guidelines, these must be set
' relative to the size of the view that the user sees, not to
' the total size including the unseen part. In this example,
' these must be set relative to the picture box, not to the image.
'Maximum: Calculate in steps:
'Step 1: The maximum to scroll is the size of the unseen part.
'Step 2: Add the size of visible scrollbars if necessary.
'Step 3: Add an adjustment factor of ScrollBar.LargeChange.
'Configure the horizontal scrollbar
'---------------------------------------------
If (Me.hScrollBar1.Visible) Then
Me.hScrollBar1.Minimum = 0
Me.hScrollBar1.SmallChange = CInt(Me.pictureBox1.Width / 20)
Me.hScrollBar1.LargeChange = CInt(Me.pictureBox1.Width / 10)
Me.hScrollBar1.Maximum = Me.pictureBox1.Image.Size.Width - pictureBox1.ClientSize.Width 'step 1
If (Me.vScrollBar1.Visible) Then 'step 2
Me.hScrollBar1.Maximum += Me.vScrollBar1.Width
End If
Me.hScrollBar1.Maximum += Me.hScrollBar1.LargeChange 'step 3
End If
'Configure the vertical scrollbar
'---------------------------------------------
If (Me.vScrollBar1.Visible) Then
Me.vScrollBar1.Minimum = 0
Me.vScrollBar1.SmallChange = CInt(Me.pictureBox1.Height / 20)
Me.vScrollBar1.LargeChange = CInt(Me.pictureBox1.Height / 10)
Me.vScrollBar1.Maximum = Me.pictureBox1.Image.Size.Height - pictureBox1.ClientSize.Height 'step 1
If (Me.hScrollBar1.Visible) Then 'step 2
Me.vScrollBar1.Maximum += Me.hScrollBar1.Height
End If
Me.vScrollBar1.Maximum += Me.vScrollBar1.LargeChange 'step 3
End If
End Sub
Megjegyzések
Amikor a felhasználó a görgetősáv sávjára kattint a görgetőmező mindkét oldalán, a tulajdonság a Value tulajdonságban LargeChange beállított értéknek megfelelően változik.
Note
A billentyűlenyomási eseményeket úgy kezelheti, hogy amikor a felhasználó lenyomja a PAGE UP vagy a PAGE DOWN billentyűt, a görgetőmező elmozdul.
A felhasználói felületre vonatkozó irányelvek azt javasolják, hogy a tulajdonságok és SmallChange a LargeChange tulajdonságok a felhasználó által látott nézet méretéhez viszonyítva legyenek beállítva, nem pedig a teljes mérethez, beleértve a nem látható részt is. Ha például egy nagyméretű képet megjelenítő görgetősávokkal rendelkező képmezővel rendelkezik, a tulajdonságokat és SmallChange a LargeChange tulajdonságokat a képdoboz méretéhez viszonyítva kell beállítani, nem pedig a kép méretéhez.