How to find the upper left coordinate of a panel when scrolling? (.net 2)
Let's say an example in VB.NET that maintains a textBox in the left border of the custom the panel (myPanel.vb):
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
TextBox1.Location = New Point(AutoScrollPosition.X, TextBox1.Location.Y)
...
this code does not work...
I tried also
Dim parentPanel As Panel = DirectCast(Parent, Panel)
TextBox1.Location = _
New Point(parentPanel.AutoScrollPosition.X, TextBox1.Location.Y)
not work as well.
In first case AutoscrollPosition remains always = 0, in the second, the panel does not scroll at all.