This is what i have so far.
I can scroll my canvas with 3 TextField controls on it. Check.
I can switch my vertical scrollbar on and off and resize the embedded control in width when no scrollbar is visible. Check.
I can scroll too far, so that the controls disappear on top of the window. I’d like to have normal scrollbar behavior, so that the last control stays at the bottom of the window.I think this has something to do with the scrollbar.maximum.
This is my code:
Canvas1 MouseWheel Event (350px is the vertical space i need to display my 3 Textfields):
if WndMain.Height < 350 then
VerticalScrollBar.Value = VerticalScrollBar.Value + deltaY
end if
Canvas1 MouseWheel Event:
if WndMain.Height < 350 then
VerticalScrollBar.Value = VerticalScrollBar.Value + deltaY
Return True
end if
VerticalScrollBar MousWheel Event (same code as Canvas1 MouseWheel Event):
if WndMain.Height < 350 then
VerticalScrollBar.Value = VerticalScrollBar.Value + deltaY
Return True
end if
VerticalScrollBar ValueChanged Event:
if self.Height > 350 then return
Dim delta As Integer
delta = mVerticalScrollBarLast - Me.Value
delta = (delta/Me.Maximum) * Canvas1.Height
mYScroll = mYScroll + delta
Canvas1.Scroll(0, delta)
mVerticalScrollBarLast = Me.Value
WndMain Open Event:
if WndMain.Height > 350 then
VerticalScrollBar.Visible = False
if TextField1.Width = 245 then
TextField1.Width = TextField1.Width + 15
TextField2.Width = TextField2.Width + 15
TextField3.Width = TextField3.Width + 15
Canvas1.Refresh
end if
else
VerticalScrollBar.Visible = True
if TextField1.width = 260 then
TextField1.Width = TextField1.Width - 15
TextField2.Width = TextField2.Width - 15
TextField3.Width = TextField3.Width - 15
Canvas1.Refresh
end if
end if
VerticalScrollBar.Maximum = Canvas1.Height
WndMain Resized Event (same code as WndMain Open Event):
if WndMain.Height > 350 then
VerticalScrollBar.Visible = False
if TextField1.Width = 245 then
TextField1.Width = TextField1.Width + 15
TextField2.Width = TextField2.Width + 15
TextField3.Width = TextField3.Width + 15
Canvas1.Refresh
end if
else
VerticalScrollBar.Visible = True
if TextField1.width = 260 then
TextField1.Width = TextField1.Width - 15
TextField2.Width = TextField2.Width - 15
TextField3.Width = TextField3.Width - 15
Canvas1.Refresh
end if
end if
VerticalScrollBar.Maximum = Canvas1.Height
And i use 3 Integer Properties in this code:
mVerticalScrollBarLast
mXScroll
mYScroll
Thats it. There must be an error but i can’t see it.