Scrollbars

  • Thread starter Thread starter Dino M. Buljubasic
  • Start date Start date
D

Dino M. Buljubasic

I have a treeview and a checked list view controls one beside another. I
want to make them work so that when I scroll down or up one of them the
other does the same.

Any help will be appreciated
 
Your going to have to use the Windows API to make the other control scroll
down. Trap the onVScroll event of the control which you want to be the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the constant for
vertical scroll to the handle of the other control.

HTH
 
They are inherited from Control - Try this - I havent tried it for the tree
control but this is a working example for the checked listbox ( This works )

Regards OHM
----------------------------------------------------------------------------
----------------------------
Public Class Form1

Inherits System.Windows.Forms.Form

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32

Const WM_VSCROLL As Int32 = &H115

Const SB_LINEDOWN As Int32 = 1

Const SB_LINEUP As Int32 = 0



#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents PerformVscroll As System.Windows.Forms.Button

Friend WithEvents rtb2 As System.Windows.Forms.RichTextBox

Friend WithEvents ScrollUP As System.Windows.Forms.Button

Friend WithEvents lb1 As System.Windows.Forms.ListBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.PerformVscroll = New System.Windows.Forms.Button

Me.rtb2 = New System.Windows.Forms.RichTextBox

Me.ScrollUP = New System.Windows.Forms.Button

Me.lb1 = New System.Windows.Forms.ListBox

Me.SuspendLayout()

'

'PerformVscroll

'

Me.PerformVscroll.Location = New System.Drawing.Point(216, 192)

Me.PerformVscroll.Name = "PerformVscroll"

Me.PerformVscroll.Size = New System.Drawing.Size(104, 23)

Me.PerformVscroll.TabIndex = 2

Me.PerformVscroll.Text = "Scroll Up"

'

'rtb2

'

Me.rtb2.Location = New System.Drawing.Point(112, 120)

Me.rtb2.Name = "rtb2"

Me.rtb2.TabIndex = 3

Me.rtb2.Text = "RichTextBox1"

'

'ScrollUP

'

Me.ScrollUP.Location = New System.Drawing.Point(216, 120)

Me.ScrollUP.Name = "ScrollUP"

Me.ScrollUP.Size = New System.Drawing.Size(104, 23)

Me.ScrollUP.TabIndex = 4

Me.ScrollUP.Text = "Scroll UP"

'

'lb1

'

Me.lb1.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", "7", "8",
"10", "11", "12", "13", "14", "12", "13", "14", "15"})

Me.lb1.Location = New System.Drawing.Point(408, 96)

Me.lb1.Name = "lb1"

Me.lb1.Size = New System.Drawing.Size(120, 95)

Me.lb1.TabIndex = 5

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(680, 293)

Me.Controls.Add(Me.lb1)

Me.Controls.Add(Me.ScrollUP)

Me.Controls.Add(Me.rtb2)

Me.Controls.Add(Me.PerformVscroll)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim ea As New EventArgs

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

rtb2.ScrollBars = RichTextBoxScrollBars.None

rtb2.Text +=
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkh
kjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhg
jghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghj
gjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkh
khgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgj
khgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjh
gjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh
jgjkhkhgjkhgkjjkhkjhgjghjgjkhkhCCCCCC*******CCCCCC"

End Sub

Private Sub PerformScroll_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

End Sub

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class
 
Thanks, but that one scroll only the label on the right. It does not scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?
 
Ok, I got it. I just have to send the message to the other controls as
well. I'll try this with the tree view and checked list view to check.

I appreciate your help.


--
Dino Buljubasic
Software Developer
http://rivusglobal.com

Dino M. Buljubasic said:
Thanks, but that one scroll only the label on the right. It does not scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?


One Handed Man said:
They are inherited from Control - Try this - I havent tried it for the tree
control but this is a working example for the checked listbox ( This works )

Regards OHM
--------------------------------------------------------------------------
--
----------------------------
Public Class Form1

Inherits System.Windows.Forms.Form

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32

Const WM_VSCROLL As Int32 = &H115

Const SB_LINEDOWN As Int32 = 1

Const SB_LINEUP As Int32 = 0



#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents PerformVscroll As System.Windows.Forms.Button

Friend WithEvents rtb2 As System.Windows.Forms.RichTextBox

Friend WithEvents ScrollUP As System.Windows.Forms.Button

Friend WithEvents lb1 As System.Windows.Forms.ListBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.PerformVscroll = New System.Windows.Forms.Button

Me.rtb2 = New System.Windows.Forms.RichTextBox

Me.ScrollUP = New System.Windows.Forms.Button

Me.lb1 = New System.Windows.Forms.ListBox

Me.SuspendLayout()

'

'PerformVscroll

'

Me.PerformVscroll.Location = New System.Drawing.Point(216, 192)

Me.PerformVscroll.Name = "PerformVscroll"

Me.PerformVscroll.Size = New System.Drawing.Size(104, 23)

Me.PerformVscroll.TabIndex = 2

Me.PerformVscroll.Text = "Scroll Up"

'

'rtb2

'

Me.rtb2.Location = New System.Drawing.Point(112, 120)

Me.rtb2.Name = "rtb2"

Me.rtb2.TabIndex = 3

Me.rtb2.Text = "RichTextBox1"

'

'ScrollUP

'

Me.ScrollUP.Location = New System.Drawing.Point(216, 120)

Me.ScrollUP.Name = "ScrollUP"

Me.ScrollUP.Size = New System.Drawing.Size(104, 23)

Me.ScrollUP.TabIndex = 4

Me.ScrollUP.Text = "Scroll UP"

'

'lb1

'

Me.lb1.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", "7", "8",
"10", "11", "12", "13", "14", "12", "13", "14", "15"})

Me.lb1.Location = New System.Drawing.Point(408, 96)

Me.lb1.Name = "lb1"

Me.lb1.Size = New System.Drawing.Size(120, 95)

Me.lb1.TabIndex = 5

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(680, 293)

Me.Controls.Add(Me.lb1)

Me.Controls.Add(Me.ScrollUP)

Me.Controls.Add(Me.rtb2)

Me.Controls.Add(Me.PerformVscroll)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim ea As New EventArgs

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

rtb2.ScrollBars = RichTextBoxScrollBars.None

rtb2.Text +=
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh
jgjkhkhgjkhgkjjkhkjhgjghjgjkhkhCCCCCC*******CCCCCC"

End Sub

Private Sub PerformScroll_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

End Sub

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





Dino M. Buljubasic said:
Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
wrote in message Your going to have to use the Windows API to make the other control scroll
down. Trap the onVScroll event of the control which you want to be the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the constant for
vertical scroll to the handle of the other control.

HTH



I have a treeview and a checked list view controls one beside another.
I
want to make them work so that when I scroll down or up one of
them
the
other does the same.

Any help will be appreciated
 
I know, my point is that you CAN control the slave even though it didnt seem
to have that event, it did. It must have because otherwise the thing wouldnt
scroll.

However, I cant think how to trap the VScroll event of the TreeView. There
must be a way to do it though, I'll have a think or maybe someone else could
jump in.

Regards OHM





Dino M. Buljubasic said:
Thanks, but that one scroll only the label on the right. It does not scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?


One Handed Man said:
They are inherited from Control - Try this - I havent tried it for the tree
control but this is a working example for the checked listbox ( This works )

Regards OHM
--------------------------------------------------------------------------
--
----------------------------
Public Class Form1

Inherits System.Windows.Forms.Form

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32

Const WM_VSCROLL As Int32 = &H115

Const SB_LINEDOWN As Int32 = 1

Const SB_LINEUP As Int32 = 0



#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents PerformVscroll As System.Windows.Forms.Button

Friend WithEvents rtb2 As System.Windows.Forms.RichTextBox

Friend WithEvents ScrollUP As System.Windows.Forms.Button

Friend WithEvents lb1 As System.Windows.Forms.ListBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.PerformVscroll = New System.Windows.Forms.Button

Me.rtb2 = New System.Windows.Forms.RichTextBox

Me.ScrollUP = New System.Windows.Forms.Button

Me.lb1 = New System.Windows.Forms.ListBox

Me.SuspendLayout()

'

'PerformVscroll

'

Me.PerformVscroll.Location = New System.Drawing.Point(216, 192)

Me.PerformVscroll.Name = "PerformVscroll"

Me.PerformVscroll.Size = New System.Drawing.Size(104, 23)

Me.PerformVscroll.TabIndex = 2

Me.PerformVscroll.Text = "Scroll Up"

'

'rtb2

'

Me.rtb2.Location = New System.Drawing.Point(112, 120)

Me.rtb2.Name = "rtb2"

Me.rtb2.TabIndex = 3

Me.rtb2.Text = "RichTextBox1"

'

'ScrollUP

'

Me.ScrollUP.Location = New System.Drawing.Point(216, 120)

Me.ScrollUP.Name = "ScrollUP"

Me.ScrollUP.Size = New System.Drawing.Size(104, 23)

Me.ScrollUP.TabIndex = 4

Me.ScrollUP.Text = "Scroll UP"

'

'lb1

'

Me.lb1.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", "7", "8",
"10", "11", "12", "13", "14", "12", "13", "14", "15"})

Me.lb1.Location = New System.Drawing.Point(408, 96)

Me.lb1.Name = "lb1"

Me.lb1.Size = New System.Drawing.Size(120, 95)

Me.lb1.TabIndex = 5

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(680, 293)

Me.Controls.Add(Me.lb1)

Me.Controls.Add(Me.ScrollUP)

Me.Controls.Add(Me.rtb2)

Me.Controls.Add(Me.PerformVscroll)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim ea As New EventArgs

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

rtb2.ScrollBars = RichTextBoxScrollBars.None

rtb2.Text +=
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh
jgjkhkhgjkhgkjjkhkjhgjghjgjkhkhCCCCCC*******CCCCCC"

End Sub

Private Sub PerformScroll_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

End Sub

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





Dino M. Buljubasic said:
Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
wrote in message Your going to have to use the Windows API to make the other control scroll
down. Trap the onVScroll event of the control which you want to be the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the constant for
vertical scroll to the handle of the other control.

HTH



I have a treeview and a checked list view controls one beside another.
I
want to make them work so that when I scroll down or up one of
them
the
other does the same.

Any help will be appreciated
 
It does work, I just tried it


Dino M. Buljubasic said:
Ok, I got it. I just have to send the message to the other controls as
well. I'll try this with the tree view and checked list view to check.

I appreciate your help.


--
Dino Buljubasic
Software Developer
http://rivusglobal.com

Dino M. Buljubasic said:
Thanks, but that one scroll only the label on the right. It does not scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh
jgjkhkhgjkhgkjjkhkjhgjghjgjkhkhCCCCCC*******CCCCCC"

End Sub

Private Sub PerformScroll_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

End Sub

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
wrote in message Your going to have to use the Windows API to make the other control
scroll
down. Trap the onVScroll event of the control which you want to be the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the
constant
for
vertical scroll to the handle of the other control.

HTH



I have a treeview and a checked list view controls one beside another.
I
want to make them work so that when I scroll down or up one of them
the
other does the same.

Any help will be appreciated
 
Yes, it does. Thank you. Do you know how can I make the scrollbars
invisible, so I can use only the buttons?

Thank you

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

One Handed Man said:
I know, my point is that you CAN control the slave even though it didnt seem
to have that event, it did. It must have because otherwise the thing wouldnt
scroll.

However, I cant think how to trap the VScroll event of the TreeView. There
must be a way to do it though, I'll have a think or maybe someone else could
jump in.

Regards OHM





Dino M. Buljubasic said:
Thanks, but that one scroll only the label on the right. It does not scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh
jgjkhkhgjkhgkjjkhkjhgjghjgjkhkhCCCCCC*******CCCCCC"

End Sub

Private Sub PerformScroll_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

End Sub

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
wrote in message Your going to have to use the Windows API to make the other control
scroll
down. Trap the onVScroll event of the control which you want to be the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the
constant
for
vertical scroll to the handle of the other control.

HTH



I have a treeview and a checked list view controls one beside another.
I
want to make them work so that when I scroll down or up one of them
the
other does the same.

Any help will be appreciated
 
They both behave differently. The TreeView has a scrollable peroperty which
hides the scrollbars, but it stops remote scrolling. the Listbox scrollbars
cannot be disabled.

Thats It


Dino M. Buljubasic said:
Yes, it does. Thank you. Do you know how can I make the scrollbars
invisible, so I can use only the buttons?

Thank you

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

One Handed Man said:
I know, my point is that you CAN control the slave even though it didnt seem
to have that event, it did. It must have because otherwise the thing wouldnt
scroll.

However, I cant think how to trap the VScroll event of the TreeView. There
must be a way to do it though, I'll have a think or maybe someone else could
jump in.

Regards OHM





Dino M. Buljubasic said:
Thanks, but that one scroll only the label on the right. It does not scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?


"One Handed Man [ OHM ]"
wrote in message They are inherited from Control - Try this - I havent tried it for the
tree
control but this is a working example for the checked listbox ( This
works )

Regards OHM

--------------------------------------------------------------------------
--
----------------------------
Public Class Form1

Inherits System.Windows.Forms.Form

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"
(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32

Const WM_VSCROLL As Int32 = &H115

Const SB_LINEDOWN As Int32 = 1

Const SB_LINEUP As Int32 = 0



#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents PerformVscroll As System.Windows.Forms.Button

Friend WithEvents rtb2 As System.Windows.Forms.RichTextBox

Friend WithEvents ScrollUP As System.Windows.Forms.Button

Friend WithEvents lb1 As System.Windows.Forms.ListBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.PerformVscroll = New System.Windows.Forms.Button

Me.rtb2 = New System.Windows.Forms.RichTextBox

Me.ScrollUP = New System.Windows.Forms.Button

Me.lb1 = New System.Windows.Forms.ListBox

Me.SuspendLayout()

'

'PerformVscroll

'

Me.PerformVscroll.Location = New System.Drawing.Point(216, 192)

Me.PerformVscroll.Name = "PerformVscroll"

Me.PerformVscroll.Size = New System.Drawing.Size(104, 23)

Me.PerformVscroll.TabIndex = 2

Me.PerformVscroll.Text = "Scroll Up"

'

'rtb2

'

Me.rtb2.Location = New System.Drawing.Point(112, 120)

Me.rtb2.Name = "rtb2"

Me.rtb2.TabIndex = 3

Me.rtb2.Text = "RichTextBox1"

'

'ScrollUP

'

Me.ScrollUP.Location = New System.Drawing.Point(216, 120)

Me.ScrollUP.Name = "ScrollUP"

Me.ScrollUP.Size = New System.Drawing.Size(104, 23)

Me.ScrollUP.TabIndex = 4

Me.ScrollUP.Text = "Scroll UP"

'

'lb1

'

Me.lb1.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", "7",
"8",
"10", "11", "12", "13", "14", "12", "13", "14", "15"})

Me.lb1.Location = New System.Drawing.Point(408, 96)

Me.lb1.Name = "lb1"

Me.lb1.Size = New System.Drawing.Size(120, 95)

Me.lb1.TabIndex = 5

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(680, 293)

Me.Controls.Add(Me.lb1)

Me.Controls.Add(Me.ScrollUP)

Me.Controls.Add(Me.rtb2)

Me.Controls.Add(Me.PerformVscroll)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim ea As New EventArgs

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

rtb2.ScrollBars = RichTextBoxScrollBars.None

rtb2.Text +=
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh
jgjkhkhgjkhgkjjkhkjhgjghjgjkhkhCCCCCC*******CCCCCC"

End Sub

Private Sub PerformScroll_Click(ByVal sender As System.Object, ByVal
e
As
System.EventArgs) Handles PerformVscroll.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

End Sub

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
wrote in message Your going to have to use the Windows API to make the other control
scroll
down. Trap the onVScroll event of the control which you want to
be
the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the constant
for
vertical scroll to the handle of the other control.

HTH



message
I have a treeview and a checked list view controls one beside
another.
I
want to make them work so that when I scroll down or up one of them
the
other does the same.

Any help will be appreciated
 
What about panel. I am actually using a panel with check boxes on it, not a
checked list view.

I am trying to find some references on my own, but MSDN does not says much.
I found somethig about scrollableClass with VScroll and HScroll properties
but don't know how to access them. I know that panel inherit from this
class, but don't know about treeview.

Tx
--
Dino Buljubasic
Software Developer
http://rivusglobal.com

One Handed Man said:
They both behave differently. The TreeView has a scrollable peroperty which
hides the scrollbars, but it stops remote scrolling. the Listbox scrollbars
cannot be disabled.

Thats It


Dino M. Buljubasic said:
Yes, it does. Thank you. Do you know how can I make the scrollbars
invisible, so I can use only the buttons?

Thank you

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

One Handed Man said:
I know, my point is that you CAN control the slave even though it
didnt
seem
to have that event, it did. It must have because otherwise the thing wouldnt
scroll.

However, I cant think how to trap the VScroll event of the TreeView. There
must be a way to do it though, I'll have a think or maybe someone else could
jump in.

Regards OHM





Thanks, but that one scroll only the label on the right. It does not
scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?


"One Handed Man [ OHM ]"
wrote in message They are inherited from Control - Try this - I havent tried it for the
tree
control but this is a working example for the checked listbox ( This
works )

Regards OHM

--------------------------------------------------------------------------
--
----------------------------
Public Class Form1

Inherits System.Windows.Forms.Form

Private Declare Function SendMessage Lib "user32.dll" Alias
"SendMessageA"
(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32

Const WM_VSCROLL As Int32 = &H115

Const SB_LINEDOWN As Int32 = 1

Const SB_LINEUP As Int32 = 0



#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents PerformVscroll As System.Windows.Forms.Button

Friend WithEvents rtb2 As System.Windows.Forms.RichTextBox

Friend WithEvents ScrollUP As System.Windows.Forms.Button

Friend WithEvents lb1 As System.Windows.Forms.ListBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.PerformVscroll = New System.Windows.Forms.Button

Me.rtb2 = New System.Windows.Forms.RichTextBox

Me.ScrollUP = New System.Windows.Forms.Button

Me.lb1 = New System.Windows.Forms.ListBox

Me.SuspendLayout()

'

'PerformVscroll

'

Me.PerformVscroll.Location = New System.Drawing.Point(216, 192)

Me.PerformVscroll.Name = "PerformVscroll"

Me.PerformVscroll.Size = New System.Drawing.Size(104, 23)

Me.PerformVscroll.TabIndex = 2

Me.PerformVscroll.Text = "Scroll Up"

'

'rtb2

'

Me.rtb2.Location = New System.Drawing.Point(112, 120)

Me.rtb2.Name = "rtb2"

Me.rtb2.TabIndex = 3

Me.rtb2.Text = "RichTextBox1"

'

'ScrollUP

'

Me.ScrollUP.Location = New System.Drawing.Point(216, 120)

Me.ScrollUP.Name = "ScrollUP"

Me.ScrollUP.Size = New System.Drawing.Size(104, 23)

Me.ScrollUP.TabIndex = 4

Me.ScrollUP.Text = "Scroll UP"

'

'lb1

'

Me.lb1.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", "7",
"8",
"10", "11", "12", "13", "14", "12", "13", "14", "15"})

Me.lb1.Location = New System.Drawing.Point(408, 96)

Me.lb1.Name = "lb1"

Me.lb1.Size = New System.Drawing.Size(120, 95)

Me.lb1.TabIndex = 5

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(680, 293)

Me.Controls.Add(Me.lb1)

Me.Controls.Add(Me.ScrollUP)

Me.Controls.Add(Me.rtb2)

Me.Controls.Add(Me.PerformVscroll)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim ea As New EventArgs

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

rtb2.ScrollBars = RichTextBoxScrollBars.None

rtb2.Text +=
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh ByVal
e
As
System.EventArgs) Handles PerformVscroll.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEDOWN, 0)

End Sub

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
<terry_burnsREMOVE%FOR%NO%[email protected]>
wrote in message Your going to have to use the Windows API to make the other control
scroll
down. Trap the onVScroll event of the control which you want
to
 
I'm all used up tonight, need food.

Good Luck

Dino M. Buljubasic said:
What about panel. I am actually using a panel with check boxes on it, not a
checked list view.

I am trying to find some references on my own, but MSDN does not says much.
I found somethig about scrollableClass with VScroll and HScroll properties
but don't know how to access them. I know that panel inherit from this
class, but don't know about treeview.

Tx
--
Dino Buljubasic
Software Developer
http://rivusglobal.com

One Handed Man said:
They both behave differently. The TreeView has a scrollable peroperty which
hides the scrollbars, but it stops remote scrolling. the Listbox scrollbars
cannot be disabled.

Thats It


Dino M. Buljubasic said:
Yes, it does. Thank you. Do you know how can I make the scrollbars
invisible, so I can use only the buttons?

Thank you

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

"One Handed Man [ OHM ]"
wrote in message I know, my point is that you CAN control the slave even though it didnt
seem
to have that event, it did. It must have because otherwise the thing
wouldnt
scroll.

However, I cant think how to trap the VScroll event of the TreeView. There
must be a way to do it though, I'll have a think or maybe someone else
could
jump in.

Regards OHM





Thanks, but that one scroll only the label on the right. It does not
scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?


"One Handed Man [ OHM ]"
wrote in message They are inherited from Control - Try this - I havent tried it
for
the
tree
control but this is a working example for the checked listbox ( This
works )

Regards OHM

--------------------------------------------------------------------------
--
----------------------------
Public Class Form1

Inherits System.Windows.Forms.Form

Private Declare Function SendMessage Lib "user32.dll" Alias
"SendMessageA"
(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32,
ByVal
lParam As Int32) As Int32

Const WM_VSCROLL As Int32 = &H115

Const SB_LINEDOWN As Int32 = 1

Const SB_LINEUP As Int32 = 0



#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents PerformVscroll As System.Windows.Forms.Button

Friend WithEvents rtb2 As System.Windows.Forms.RichTextBox

Friend WithEvents ScrollUP As System.Windows.Forms.Button

Friend WithEvents lb1 As System.Windows.Forms.ListBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.PerformVscroll = New System.Windows.Forms.Button

Me.rtb2 = New System.Windows.Forms.RichTextBox

Me.ScrollUP = New System.Windows.Forms.Button

Me.lb1 = New System.Windows.Forms.ListBox

Me.SuspendLayout()

'

'PerformVscroll

'

Me.PerformVscroll.Location = New System.Drawing.Point(216, 192)

Me.PerformVscroll.Name = "PerformVscroll"

Me.PerformVscroll.Size = New System.Drawing.Size(104, 23)

Me.PerformVscroll.TabIndex = 2

Me.PerformVscroll.Text = "Scroll Up"

'

'rtb2

'

Me.rtb2.Location = New System.Drawing.Point(112, 120)

Me.rtb2.Name = "rtb2"

Me.rtb2.TabIndex = 3

Me.rtb2.Text = "RichTextBox1"

'

'ScrollUP

'

Me.ScrollUP.Location = New System.Drawing.Point(216, 120)

Me.ScrollUP.Name = "ScrollUP"

Me.ScrollUP.Size = New System.Drawing.Size(104, 23)

Me.ScrollUP.TabIndex = 4

Me.ScrollUP.Text = "Scroll UP"

'

'lb1

'

Me.lb1.Items.AddRange(New Object() {"1", "2", "3", "4", "5",
"6",
"7",
"8",
"10", "11", "12", "13", "14", "12", "13", "14", "15"})

Me.lb1.Location = New System.Drawing.Point(408, 96)

Me.lb1.Name = "lb1"

Me.lb1.Size = New System.Drawing.Size(120, 95)

Me.lb1.TabIndex = 5

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(680, 293)

Me.Controls.Add(Me.lb1)

Me.Controls.Add(Me.ScrollUP)

Me.Controls.Add(Me.rtb2)

Me.Controls.Add(Me.PerformVscroll)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Dim ea As New EventArgs

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

rtb2.ScrollBars = RichTextBoxScrollBars.None

rtb2.Text +=
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh
e
As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





message
Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
<terry_burnsREMOVE%FOR%NO%[email protected]>
wrote in message Your going to have to use the Windows API to make the other
control
scroll
down. Trap the onVScroll event of the control which you want
to
be
the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the
constant
for
vertical scroll to the handle of the other control.

HTH



message
I have a treeview and a checked list view controls one beside
another.
I
want to make them work so that when I scroll down or up
one
 
Thanks


One Handed Man said:
I'm all used up tonight, need food.

Good Luck

Dino M. Buljubasic said:
What about panel. I am actually using a panel with check boxes on it,
not
a
checked list view.

I am trying to find some references on my own, but MSDN does not says much.
I found somethig about scrollableClass with VScroll and HScroll properties
but don't know how to access them. I know that panel inherit from this
class, but don't know about treeview.

Tx
--
Dino Buljubasic
Software Developer
http://rivusglobal.com

One Handed Man said:
They both behave differently. The TreeView has a scrollable peroperty which
hides the scrollbars, but it stops remote scrolling. the Listbox scrollbars
cannot be disabled.

Thats It


Yes, it does. Thank you. Do you know how can I make the scrollbars
invisible, so I can use only the buttons?

Thank you

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

"One Handed Man [ OHM ]"
wrote in message I know, my point is that you CAN control the slave even though it didnt
seem
to have that event, it did. It must have because otherwise the thing
wouldnt
scroll.

However, I cant think how to trap the VScroll event of the TreeView.
There
must be a way to do it though, I'll have a think or maybe someone else
could
jump in.

Regards OHM





Thanks, but that one scroll only the label on the right. It
does
not
scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?


"One Handed Man [ OHM ]"
<terry_burnsREMOVE%FOR%NO%[email protected]>
wrote in message They are inherited from Control - Try this - I havent tried it for
the
tree
control but this is a working example for the checked listbox
(
This
works )

Regards OHM

--------------------------------------------------------------------------
--
----------------------------
Public Class Form1

Inherits System.Windows.Forms.Form

Private Declare Function SendMessage Lib "user32.dll" Alias
"SendMessageA"
(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32,
ByVal
lParam As Int32) As Int32

Const WM_VSCROLL As Int32 = &H115

Const SB_LINEDOWN As Int32 = 1

Const SB_LINEUP As Int32 = 0



#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents PerformVscroll As System.Windows.Forms.Button

Friend WithEvents rtb2 As System.Windows.Forms.RichTextBox

Friend WithEvents ScrollUP As System.Windows.Forms.Button

Friend WithEvents lb1 As System.Windows.Forms.ListBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.PerformVscroll = New System.Windows.Forms.Button

Me.rtb2 = New System.Windows.Forms.RichTextBox

Me.ScrollUP = New System.Windows.Forms.Button

Me.lb1 = New System.Windows.Forms.ListBox

Me.SuspendLayout()

'

'PerformVscroll

'

Me.PerformVscroll.Location = New System.Drawing.Point(216, 192)

Me.PerformVscroll.Name = "PerformVscroll"

Me.PerformVscroll.Size = New System.Drawing.Size(104, 23)

Me.PerformVscroll.TabIndex = 2

Me.PerformVscroll.Text = "Scroll Up"

'

'rtb2

'

Me.rtb2.Location = New System.Drawing.Point(112, 120)

Me.rtb2.Name = "rtb2"

Me.rtb2.TabIndex = 3

Me.rtb2.Text = "RichTextBox1"

'

'ScrollUP

'

Me.ScrollUP.Location = New System.Drawing.Point(216, 120)

Me.ScrollUP.Name = "ScrollUP"

Me.ScrollUP.Size = New System.Drawing.Size(104, 23)

Me.ScrollUP.TabIndex = 4

Me.ScrollUP.Text = "Scroll UP"

'

'lb1

'

Me.lb1.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6",
"7",
"8",
"10", "11", "12", "13", "14", "12", "13", "14", "15"})

Me.lb1.Location = New System.Drawing.Point(408, 96)

Me.lb1.Name = "lb1"

Me.lb1.Size = New System.Drawing.Size(120, 95)

Me.lb1.TabIndex = 5

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(680, 293)

Me.Controls.Add(Me.lb1)

Me.Controls.Add(Me.ScrollUP)

Me.Controls.Add(Me.rtb2)

Me.Controls.Add(Me.PerformVscroll)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e
As
System.EventArgs)

Dim ea As New EventArgs

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

rtb2.ScrollBars = RichTextBoxScrollBars.None

rtb2.Text +=
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh e
ByVal
e
As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





message
Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
<terry_burnsREMOVE%FOR%NO%[email protected]>
wrote in message Your going to have to use the Windows API to make the other
control
scroll
down. Trap the onVScroll event of the control which you
want
to
be
the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the
constant
for
vertical scroll to the handle of the other control.

HTH



"Dino M. Buljubasic" <[email protected]>
wrote
in
message
I have a treeview and a checked list view controls one beside
another.
I
want to make them work so that when I scroll down or up
one
of
them
the
other does the same.

Any help will be appreciated
 
Hi,

I got a very simple sollution to this.

Put your controls simply into a panel Control, sets its property AutoScroll
to True.

The two controls inside the panel, say another pannel holding checkboxes and
a treeview should have their properties AutoScroll and Scrollable
respectively set to False.

Since panel inherits from ScrollableControl class, the two controls inside
will do the same. Therefore, no need for them to have their own scroll
bars.


--
Dino Buljubasic
Software Developer
http://rivusglobal.com

Dino M. Buljubasic said:
Thanks


One Handed Man said:
I'm all used up tonight, need food.

Good Luck

Dino M. Buljubasic said:
What about panel. I am actually using a panel with check boxes on it,
not
a
checked list view.

I am trying to find some references on my own, but MSDN does not says much.
I found somethig about scrollableClass with VScroll and HScroll properties
but don't know how to access them. I know that panel inherit from this
class, but don't know about treeview.

Tx
--
Dino Buljubasic
Software Developer
http://rivusglobal.com

"One Handed Man [ OHM ]"
wrote in message They both behave differently. The TreeView has a scrollable peroperty
which
hides the scrollbars, but it stops remote scrolling. the Listbox
scrollbars
cannot be disabled.

Thats It


Yes, it does. Thank you. Do you know how can I make the scrollbars
invisible, so I can use only the buttons?

Thank you

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

"One Handed Man [ OHM ]"
wrote in message I know, my point is that you CAN control the slave even though it
didnt
seem
to have that event, it did. It must have because otherwise the thing
wouldnt
scroll.

However, I cant think how to trap the VScroll event of the TreeView.
There
must be a way to do it though, I'll have a think or maybe
someone
else
could
jump in.

Regards OHM





message
Thanks, but that one scroll only the label on the right. It does
not
scroll
the rich text box on the left.

Is it possible to make them scroll both at the same time?


"One Handed Man [ OHM ]"
<terry_burnsREMOVE%FOR%NO%[email protected]>
wrote in message They are inherited from Control - Try this - I havent tried
it
for
the
tree
control but this is a working example for the checked
listbox
(

--------------------------------------------------------------------------
ByVal
e
"RichTextBox1jkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghJJJJJkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjghjgjkhkhgjkhgkjjkhkjhgjgh ByVal
e
As
System.EventArgs) Handles rtb2.VScroll

Console.WriteLine("Scrolling")

End Sub

Private Sub ScrollUP_Click(ByVal sender As System.Object,
ByVal
e
As
System.EventArgs) Handles ScrollUP.Click

'SendMessage(rtb2.Handle, WM_VSCROLL, SB_LINEUP, 0)

SendMessage(lb1.Handle, WM_VSCROLL, SB_LINEUP, 0)

End Sub

End Class





message
Tree View or Checked List View do not have onVScroll event.


"One Handed Man [ OHM ]"
<terry_burnsREMOVE%FOR%NO%[email protected]>
wrote in message Your going to have to use the Windows API to make the other
control
scroll
down. Trap the onVScroll event of the control which you want
to
be
the
master and have it send a message to the slave control.

You need to use the User32.DLL and send a Message using the
constant
for
vertical scroll to the handle of the other control.

HTH



in
message
I have a treeview and a checked list view controls one
beside
another.
I
want to make them work so that when I scroll down or
up
one
of
them
the
other does the same.

Any help will be appreciated
 
This does not work for me.
Put your controls simply into a panel Control, sets its property AutoScroll
to True. OK

The two controls inside the panel, say another pannel holding checkboxes and
a treeview should have their properties AutoScroll and Scrollable
respectively set to False.
TreeView does not have Autoscroll and if you set scrollable to False it will
not scroll, Checked Listbox does not havve an option to take out the scroll
bars on vertical
 
Back
Top