A
Antony
Please excuse me for yet another silly question but which event on a
USERCONTROL indicates that the horizontal or vertical scrollbar has
changed position. I have written the code below which contains a
USERCONTROL with scrollbars on horizontal and vertical positions (as
Me.testUserControl.AutoScrollMinSize is greater than
Me.testUserControl.Size). It can be pasted directly into Visual
Studio, the whole thing into and over "Form1" if creating a new
project to see what I mean. All I want to do is have an event raised
by the usercontrol to Form1 saying "My scrollbars have changed
position, and current values are ...." but I just can't find the event
to use.
Thank you and apologies for asking all these simple questions without
contributing back to the newsgroup.
Tony
Public Class testUserControl
Inherits System.Windows.Forms.UserControl
Private Sub InitializeComponent()
Me.Name = "testUserControl"
Me.Size = New System.Drawing.Size(136, 150)
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
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 testUserControl As
WindowsApplication7.testUserControl
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.testUserControl = New testUserControl
Me.SuspendLayout()
Me.testUserControl.AutoScroll = True
Me.testUserControl.AutoScrollMinSize = New
System.Drawing.Size(100, 100)
Me.testUserControl.Location = New System.Drawing.Point(24, 16)
Me.testUserControl.Name = "UserControl11"
Me.testUserControl.Size = New System.Drawing.Size(72, 80)
Me.testUserControl.TabIndex = 0
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.testUserControl)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.testUserControl.AutoScrollMinSize = New Size(200, 200)
Me.testUserControl.BackColor = Color.Blue
Me.BackColor = Color.Gray
Me.testUserControl.Size = New Size(100, 100)
End Sub
End Class
USERCONTROL indicates that the horizontal or vertical scrollbar has
changed position. I have written the code below which contains a
USERCONTROL with scrollbars on horizontal and vertical positions (as
Me.testUserControl.AutoScrollMinSize is greater than
Me.testUserControl.Size). It can be pasted directly into Visual
Studio, the whole thing into and over "Form1" if creating a new
project to see what I mean. All I want to do is have an event raised
by the usercontrol to Form1 saying "My scrollbars have changed
position, and current values are ...." but I just can't find the event
to use.
Thank you and apologies for asking all these simple questions without
contributing back to the newsgroup.
Tony
Public Class testUserControl
Inherits System.Windows.Forms.UserControl
Private Sub InitializeComponent()
Me.Name = "testUserControl"
Me.Size = New System.Drawing.Size(136, 150)
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
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 testUserControl As
WindowsApplication7.testUserControl
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.testUserControl = New testUserControl
Me.SuspendLayout()
Me.testUserControl.AutoScroll = True
Me.testUserControl.AutoScrollMinSize = New
System.Drawing.Size(100, 100)
Me.testUserControl.Location = New System.Drawing.Point(24, 16)
Me.testUserControl.Name = "UserControl11"
Me.testUserControl.Size = New System.Drawing.Size(72, 80)
Me.testUserControl.TabIndex = 0
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.testUserControl)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.testUserControl.AutoScrollMinSize = New Size(200, 200)
Me.testUserControl.BackColor = Color.Blue
Me.BackColor = Color.Gray
Me.testUserControl.Size = New Size(100, 100)
End Sub
End Class