Hallo Kai,
ein Beispiel mit Scroll-Panel:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Vom Windows Form Designer generierter Code "
Public Sub New()
MyBase.New()
' Dieser Aufruf ist für den Windows Form-Designer erforderlich.
InitializeComponent()
Application.EnableVisualStyles()
' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen
End Sub
' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu
' bereinigen.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' Für Windows Form-Designer erforderlich
Private components As System.ComponentModel.IContainer
'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer
' erforderlich
'Sie kann mit dem Windows Form-Designer modifiziert werden.
'Verwenden Sie nicht den Code-Editor zur Bearbeitung.
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents VScrollBar1 As System.Windows.Forms.VScrollBar
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New _
System.Resources.ResourceManager(GetType(Form1))
Me.Panel1 = New System.Windows.Forms.Panel
Me.VScrollBar1 = New System.Windows.Forms.VScrollBar
Me.Panel2 = New System.Windows.Forms.Panel
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.Panel1.SuspendLayout()
Me.Panel2.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), _
CType(255, Byte), CType(192, Byte))
Me.Panel1.Controls.Add(Me.VScrollBar1)
Me.Panel1.Controls.Add(Me.Panel2)
Me.Panel1.Location = New System.Drawing.Point(8, 8)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(360, 136)
Me.Panel1.TabIndex = 0
'
'VScrollBar1
'
Me.VScrollBar1.Location = New System.Drawing.Point(320, 0)
Me.VScrollBar1.Name = "VScrollBar1"
Me.VScrollBar1.Size = New System.Drawing.Size(40, 136)
Me.VScrollBar1.TabIndex = 10
'
'Panel2
'
Me.Panel2.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), _
CType(255, Byte), CType(192, Byte))
Me.Panel2.Controls.Add(Me.PictureBox1)
Me.Panel2.Location = New System.Drawing.Point(0, 0)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(320, 256)
Me.Panel2.TabIndex = 0
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), _
System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(8, 8)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(304, 240)
Me.PictureBox1.SizeMode = _
System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(376, 150)
Me.Controls.Add(Me.Panel1)
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Form1"
Me.Panel1.ResumeLayout(False)
Me.Panel2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As _
System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
Panel2.Top = -e.NewValue
End Sub
End ClassGruß
Lars |