Here's what I came up with to get this to do what I wanted... However there are 2 sets of scrollbars... The one for the Panel at 17 pixels and the ones that I designed at 40 pixels.
While not perfect, this methodology seems to work!
---
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
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
Private components As System.ComponentModel.IContainer
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox
Friend WithEvents HScrollBar1 As System.Windows.Forms.HScrollBar
Friend WithEvents Panel3 As System.Windows.Forms.Panel
Friend WithEvents VScrollBar1 As System.Windows.Forms.VScrollBar
Friend WithEvents Splitter2 As System.Windows.Forms.Splitter
Friend WithEvents Splitter1 As System.Windows.Forms.Splitter
Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.Panel1 = New System.Windows.Forms.Panel
Me.Panel3 = New System.Windows.Forms.Panel
Me.VScrollBar1 = New System.Windows.Forms.VScrollBar
Me.Panel2 = New System.Windows.Forms.Panel
Me.HScrollBar1 = New System.Windows.Forms.HScrollBar
Me.PictureBox2 = New System.Windows.Forms.PictureBox
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.Splitter2 = New System.Windows.Forms.Splitter
Me.Splitter1 = New System.Windows.Forms.Splitter
Me.Panel1.SuspendLayout()
Me.Panel3.SuspendLayout()
Me.Panel2.SuspendLayout()
Me.SuspendLayout()
Me.Panel1.AutoScroll = True
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Panel1.Controls.Add(Me.PictureBox1)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(494, 408)
Me.Panel1.TabIndex = 0
Me.Panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Panel3.Controls.Add(Me.Splitter1)
Me.Panel3.Controls.Add(Me.VScrollBar1)
Me.Panel3.Controls.Add(Me.PictureBox2)
Me.Panel3.Dock = System.Windows.Forms.DockStyle.Right
Me.Panel3.Location = New System.Drawing.Point(494, 0)
Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(42, 450)
Me.Panel3.TabIndex = 2
Me.VScrollBar1.Dock = System.Windows.Forms.DockStyle.Fill
Me.VScrollBar1.LargeChange = 50
Me.VScrollBar1.Location = New System.Drawing.Point(0, 0)
Me.VScrollBar1.Name = "VScrollBar1"
Me.VScrollBar1.Size = New System.Drawing.Size(40, 408)
Me.VScrollBar1.TabIndex = 1
Me.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Panel2.Controls.Add(Me.HScrollBar1)
Me.Panel2.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Panel2.Location = New System.Drawing.Point(0, 408)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(494, 42)
Me.Panel2.TabIndex = 1
Me.HScrollBar1.Dock = System.Windows.Forms.DockStyle.Fill
Me.HScrollBar1.LargeChange = 50
Me.HScrollBar1.Location = New System.Drawing.Point(0, 0)
Me.HScrollBar1.Name = "HScrollBar1"
Me.HScrollBar1.Size = New System.Drawing.Size(492, 40)
Me.HScrollBar1.TabIndex = 2
Me.PictureBox2.Dock = System.Windows.Forms.DockStyle.Bottom
Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Image)
Me.PictureBox2.Location = New System.Drawing.Point(0, 408)
Me.PictureBox2.Name = "PictureBox2"
Me.PictureBox2.Size = New System.Drawing.Size(40, 40)
Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.PictureBox2.TabIndex = 0
Me.PictureBox2.TabStop = False
Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.PictureBox1.Location = New System.Drawing.Point(380, 328)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(368, 316)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
Me.Splitter2.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Splitter2.Enabled = False
Me.Splitter2.Location = New System.Drawing.Point(0, 407)
Me.Splitter2.Name = "Splitter2"
Me.Splitter2.Size = New System.Drawing.Size(494, 1)
Me.Splitter2.TabIndex = 3
Me.Splitter2.TabStop = False
Me.Splitter1.BackColor = System.Drawing.Color.Black
Me.Splitter1.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Splitter1.Location = New System.Drawing.Point(0, 407)
Me.Splitter1.Name = "Splitter1"
Me.Splitter1.Size = New System.Drawing.Size(40, 1)
Me.Splitter1.TabIndex = 2
Me.Splitter1.TabStop = False
Me.Splitter1.Visible = False
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(536, 450)
Me.Controls.Add(Me.Splitter2)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.Panel2)
Me.Controls.Add(Me.Panel3)
Me.Name = "Form1"
Me.Text = "Form1"
Me.Panel1.ResumeLayout(False)
Me.Panel3.ResumeLayout(False)
Me.Panel2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim PictureRightSize As Integer
Dim PictureBottomSize As Integer
Dim Panel1Width As Integer
Dim Panel1Height As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RecalculateFormScrollBarData()
End Sub
Private Sub RecalculateFormScrollBarData()
Dim ScrollSize As Integer = Panel2.Height + 17 + 10
Panel1Width = Panel1.Width
Panel1Height = Panel1.Height
PictureRightSize = -Panel1.AutoScrollPosition.X + PictureBox1.Location.X + PictureBox1.Width + ScrollSize - Panel1Width
PictureBottomSize = -Panel1.AutoScrollPosition.Y + PictureBox1.Location.Y + PictureBox1.Height + ScrollSize - Panel1Height
HScrollBar1.Maximum = PictureRightSize
VScrollBar1.Maximum = PictureBottomSize
End Sub
Private Sub Form1_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize
RecalculateFormScrollBarData()
End Sub
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
Panel1.AutoScrollPosition = New Point(HScrollBar1.Value, VScrollBar1.Value)
Panel1.Invalidate()
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Panel1.AutoScrollPosition = New Point(HScrollBar1.Value, VScrollBar1.Value)
Panel1.Invalidate()
End Sub
End Class
---
In the RecalculateFormScrollBarData routine, the -Panel1.AutoScrollPosition.X and -Panel1.AutoScrollPosition.Y in the calculations allow for the Panel1 Current Location Offset that we are currently viewing is taken into consideration.
So this is my best solution at the present time.
So this seems to temporarily solve the too small scrollbars for the present time!