Vb .NET hscrollbar в toolstrip sizechanged; valuechanged; etc
Hello, please help me. Which lines of code are needed to take over the most important EventHandlers? Example: ValueChanged, SizeChanged, etc... The element is not displayed correctly. If e.g. the AutoSize = False is set. Thanks for your help.
---------------
<pre>This is the original source:
<a href="https://www.codeproject.com/Questions/371056/HScrollBar-in-Toolstrip"></a>
Что я уже пробовал:
Imports System.Windows.Forms.Design Imports System.ComponentModel <ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)> Public Class ToolStripHScrollBar Inherits ToolStripControlHost Private HScrollB As New HScrollBar() Public Sub New() MyBase.New(New FlowLayoutPanel()) MyBase.Margin = New Padding(0, 5, 0, 2) HScrollB.Width = 140 MyBase.Control.Controls.Add(HScrollB) Me.Maximum = 100 Me.Minimum = 0 Me.Value = 10 AddHandler HScrollB.BindingContextChanged, AddressOf Me.Handle_BindingContextChanged AddHandler HScrollB.CausesValidationChanged, AddressOf Me.Handle_CausesValidationChanged AddHandler HScrollB.ChangeUICues, AddressOf Me.Handle_ChangeUICues AddHandler HScrollB.ClientSizeChanged, AddressOf Me.Handle_ClientSizeChanged AddHandler HScrollB.ContextMenuStripChanged, AddressOf Me.Handle_ContextMenuStripChanged AddHandler HScrollB.ControlAdded, AddressOf Me.Handle_ControlAdded AddHandler HScrollB.ControlRemoved, AddressOf Me.Handle_ControlRemoved AddHandler HScrollB.CursorChanged, AddressOf Me.Handle_CursorChanged AddHandler HScrollB.DockChanged, AddressOf Me.Handle_DockChanged AddHandler HScrollB.DragDrop, AddressOf Me.Handle_DragDrop AddHandler HScrollB.DragEnter, AddressOf Me.Handle_DragEnter AddHandler HScrollB.DragLeave, AddressOf Me.Handle_DragLeave AddHandler HScrollB.DragOver, AddressOf Me.Handle_DragOver AddHandler HScrollB.EnabledChanged, AddressOf Me.Handle_EnabledChanged AddHandler HScrollB.Enter, AddressOf Me.Handle_Enter AddHandler HScrollB.GiveFeedback, AddressOf Me.Handle_GiveFeedback AddHandler HScrollB.HelpRequested, AddressOf Me.Handle_HelpRequested AddHandler HScrollB.KeyDown, AddressOf Me.Handle_KeyDown AddHandler HScrollB.KeyPress, AddressOf Me.Handle_KeyPress AddHandler HScrollB.KeyUp, AddressOf Me.Handle_KeyUp AddHandler HScrollB.Layout, AddressOf Me.Handle_Layout AddHandler HScrollB.Leave, AddressOf Me.Handle_Leave AddHandler HScrollB.LocationChanged, AddressOf Me.Handle_LocationChanged AddHandler HScrollB.MarginChanged, AddressOf Me.Handle_MarginChanged AddHandler HScrollB.MouseCaptureChanged, AddressOf Me.Handle_MouseCaptureChanged AddHandler HScrollB.MouseEnter, AddressOf Me.Handle_MouseEnter AddHandler HScrollB.MouseHover, AddressOf Me.Handle_MouseHover AddHandler HScrollB.MouseLeave, AddressOf Me.Handle_MouseLeave AddHandler HScrollB.Move, AddressOf Me.Handle_Move AddHandler HScrollB.PaddingChanged, AddressOf Me.Handle_PaddingChanged AddHandler HScrollB.ParentChanged, AddressOf Me.Handle_ParentChanged AddHandler HScrollB.PreviewKeyDown, AddressOf Me.Handle_PreviewKeyDown AddHandler HScrollB.QueryAccessibilityHelp, AddressOf Me.Handle_QueryAccessibilityHelp AddHandler HScrollB.QueryContinueDrag, AddressOf Me.Handle_QueryContinueDrag AddHandler HScrollB.RegionChanged, AddressOf Me.Handle_RegionChanged AddHandler HScrollB.Resize, AddressOf Me.Handle_Resize AddHandler HScrollB.RightToLeftChanged, AddressOf Me.Handle_RightToLeftChanged AddHandler HScrollB.Scroll, AddressOf Me.Handle_Scroll AddHandler HScrollB.SizeChanged, AddressOf Me.Handle_SizeChanged AddHandler HScrollB.StyleChanged, AddressOf Me.Handle_StyleChanged AddHandler HScrollB.SystemColorsChanged, AddressOf Me.Handle_SystemColorsChanged AddHandler HScrollB.TabIndexChanged, AddressOf Me.Handle_TabIndexChanged AddHandler HScrollB.TabStopChanged, AddressOf Me.Handle_TabStopChanged AddHandler HScrollB.Validated, AddressOf Me.Handle_Validated AddHandler HScrollB.ValueChanged, AddressOf Me.Handle_ValueChanged AddHandler HScrollB.Validating, AddressOf Me.Handle_Validating AddHandler HScrollB.ValueChanged, AddressOf Me.Handle_ValueChanged AddHandler HScrollB.VisibleChanged, AddressOf Me.Handle_VisibleChanged End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub Public Event BindingContextChanged As EventHandler Private Sub Handle_BindingContextChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent BindingContextChanged(Me, e) End Sub Public Event CausesValidationChanged As EventHandler Private Sub Handle_CausesValidationChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent CausesValidationChanged(Me, e) End Sub Public Event ChangeUICues As UICuesEventHandler Private Sub Handle_ChangeUICues(sender As System.Object, ByVal e As UICuesEventArgs) RaiseEvent ChangeUICues(Me, e) End Sub Public Event ClientSizeChanged As EventHandler Private Sub Handle_ClientSizeChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent ClientSizeChanged(Me, e) End Sub Public Event ContextMenuStripChanged As EventHandler Private Sub Handle_ContextMenuStripChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent ContextMenuStripChanged(Me, e) End Sub Public Event ControlAdded As ControlEventHandler Private Sub Handle_ControlAdded(sender As System.Object, ByVal e As ControlEventArgs) RaiseEvent ControlAdded(Me, e) End Sub Public Event ControlRemoved As ControlEventHandler Private Sub Handle_ControlRemoved(sender As System.Object, ByVal e As ControlEventArgs) RaiseEvent ControlRemoved(Me, e) End Sub Public Event CursorChanged As EventHandler Private Sub Handle_CursorChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent CursorChanged(Me, e) End Sub Public Event DockChanged As EventHandler Private Sub Handle_DockChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent DockChanged(Me, e) End Sub Public Shadows Event DragDrop As DragEventHandler Private Sub Handle_DragDrop(sender As System.Object, ByVal e As DragEventArgs) RaiseEvent DragDrop(Me, e) End Sub Public Shadows Event DragEnter As DragEventHandler Private Sub Handle_DragEnter(sender As System.Object, ByVal e As DragEventArgs) RaiseEvent DragEnter(Me, e) End Sub Public Shadows Event DragLeave As EventHandler Private Sub Handle_DragLeave(sender As System.Object, ByVal e As EventArgs) RaiseEvent DragLeave(Me, e) End Sub Public Shadows Event DragOver As DragEventHandler Private Sub Handle_DragOver(sender As System.Object, ByVal e As DragEventArgs) RaiseEvent DragOver(Me, e) End Sub Public Shadows Event EnabledChanged As EventHandler Private Sub Handle_EnabledChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent EnabledChanged(Me, e) End Sub Public Shadows Event Enter As EventHandler Private Sub Handle_Enter(sender As System.Object, ByVal e As EventArgs) RaiseEvent Enter(Me, e) End Sub Public Shadows Event GiveFeedback As GiveFeedbackEventHandler Private Sub Handle_GiveFeedback(sender As System.Object, ByVal e As GiveFeedbackEventArgs) RaiseEvent GiveFeedback(Me, e) End Sub Public Event HelpRequested As HelpEventHandler Private Sub Handle_HelpRequested(sender As System.Object, ByVal e As HelpEventArgs) RaiseEvent HelpRequested(Me, e) End Sub Public Shadows Event KeyDown As KeyEventHandler Private Sub Handle_KeyDown(sender As System.Object, ByVal e As KeyEventArgs) RaiseEvent KeyDown(Me, e) End Sub Public Shadows Event KeyPress As KeyPressEventHandler Private Sub Handle_KeyPress(sender As System.Object, ByVal e As KeyPressEventArgs) RaiseEvent KeyPress(Me, e) End Sub Public Shadows Event KeyUp As KeyEventHandler Private Sub Handle_KeyUp(sender As System.Object, ByVal e As KeyEventArgs) RaiseEvent KeyUp(Me, e) End Sub Public Event Layout As LayoutEventHandler Private Sub Handle_Layout(sender As System.Object, ByVal e As LayoutEventArgs) RaiseEvent Layout(Me, e) End Sub Public Shadows Event Leave As EventHandler Private Sub Handle_Leave(sender As System.Object, ByVal e As EventArgs) RaiseEvent Leave(Me, e) End Sub Public Shadows Event LocationChanged As EventHandler Private Sub Handle_LocationChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent LocationChanged(Me, e) End Sub Public Shadows Event MarginChanged As EventHandler Private Sub Handle_MarginChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent MarginChanged(Me, e) End Sub Public Shadows Event MouseCaptureChanged As EventHandler Private Sub Handle_MouseCaptureChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent MouseCaptureChanged(Me, e) End Sub Public Shadows Event MouseEnter As EventHandler Private Sub Handle_MouseEnter(sender As System.Object, ByVal e As EventArgs) RaiseEvent MouseEnter(Me, e) End Sub Public Shadows Event MouseHover As EventHandler Private Sub Handle_MouseHover(sender As System.Object, ByVal e As EventArgs) RaiseEvent MouseHover(Me, e) End Sub Public Shadows Event MouseLeave As EventHandler Private Sub Handle_MouseLeave(sender As System.Object, ByVal e As EventArgs) RaiseEvent MouseHover(Me, e) End Sub Public Event Move As EventHandler Private Sub Handle_Move(sender As System.Object, ByVal e As EventArgs) RaiseEvent Move(Me, e) End Sub Public Event PaddingChanged As EventHandler Private Sub Handle_PaddingChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent PaddingChanged(Me, e) End Sub Public Event ParentChanged As EventHandler Private Sub Handle_ParentChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent ParentChanged(Me, e) End Sub Public Event PreviewKeyDown As PreviewKeyDownEventHandler Private Sub Handle_PreviewKeyDown(sender As System.Object, ByVal e As PreviewKeyDownEventArgs) RaiseEvent PreviewKeyDown(Me, e) End Sub Public Shadows Event QueryAccessibilityHelp As QueryAccessibilityHelpEventHandler Private Sub Handle_QueryAccessibilityHelp(sender As System.Object, ByVal e As QueryAccessibilityHelpEventArgs) RaiseEvent QueryAccessibilityHelp(Me, e) End Sub Public Shadows Event QueryContinueDrag As QueryContinueDragEventHandler Private Sub Handle_QueryContinueDrag(sender As System.Object, ByVal e As QueryContinueDragEventArgs) RaiseEvent QueryContinueDrag(Me, e) End Sub Public Event RegionChanged As EventHandler Private Sub Handle_RegionChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent RegionChanged(Me, e) End Sub Public Event Resize As EventHandler Private Sub Handle_Resize(sender As System.Object, ByVal e As EventArgs) RaiseEvent Resize(Me, e) End Sub Public Shadows Event RightToLeftChanged As EventHandler Private Sub Handle_RightToLeftChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent RightToLeftChanged(Me, e) End Sub Public Event Scroll As ScrollEventHandler Private Sub Handle_Scroll(sender As System.Object, ByVal e As ScrollEventArgs) RaiseEvent Scroll(Me, e) End Sub Public Event SizeChanged As EventHandler Private Sub Handle_SizeChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent SizeChanged(Me, e) End Sub Public Event StyleChanged As EventHandler Private Sub Handle_StyleChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent StyleChanged(Me, e) End Sub Public Event SystemColorsChanged As EventHandler Private Sub Handle_SystemColorsChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent SystemColorsChanged(Me, e) End Sub Public Event TabIndexChanged As EventHandler Private Sub Handle_TabIndexChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent TabIndexChanged(Me, e) End Sub Public Event TabStopChanged As EventHandler Private Sub Handle_TabStopChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent TabStopChanged(Me, e) End Sub Public Shadows Event Validated As EventHandler Private Sub Handle_Validated(sender As System.Object, ByVal e As EventArgs) RaiseEvent Validated(Me, e) End Sub Public Shadows Event Validating As CancelEventHandler Private Sub Handle_Validating(sender As System.Object, ByVal e As CancelEventArgs) RaiseEvent Validating(Me, e) End Sub Public Shadows Event ValueChanged As EventHandler Private Sub Handle_ValueChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent ValueChanged(Me, e) End Sub Public Shadows Event VisibleChanged As EventHandler Private Sub Handle_VisibleChanged(sender As System.Object, ByVal e As EventArgs) RaiseEvent VisibleChanged(Me, e) End Sub Private _Value As Integer <DefaultValue(10)> Public Property Value() As Integer Get Return _Value End Get Set(ByVal value As Integer) _Value = value HScrollB.Value = _Value Me.Invalidate() End Set End Property Private _Maximum As Integer <DefaultValue(100)> Public Property Maximum() As Integer Get Return _Maximum End Get Set(ByVal value As Integer) _Maximum = value HScrollB.Maximum = _Maximum Me.Invalidate() End Set End Property Private _Minimum As Integer <DefaultValue(0)> Public Property Minimum() As Integer Get Return _Minimum End Get Set(ByVal value As Integer) _Minimum = value HScrollB.Minimum = _Minimum Me.Invalidate() End Set End Property End Class