vb.net - move flowLayoutPanel content via two buttons from right to left -
i have flowlayoutpanel have contents (controls ) , 2 button , 1 @ right , left design in image
i want make layout panel scroll content right button right , left button left , how can please ?
i using code top buttom , need right , left
the code is
dim ypos integer
the code in top button is
if ypos > flowlayoutpanel1.horizontalscroll.maximum - 451 ypos = flowlayoutpanel1.horizontalscroll.maximum - 450 else ypos += 450 flowlayoutpanel1.autoscrollposition = new point(0, ypos) end if
and buttom button if ypos < 1 ypos = 0
else ypos -= 450 flowlayoutpanel1.autoscrollposition = new point(0, ypos) end if
thanks
increase , decrease value of horizontalscroll.value
in respective left , right button click events.
''' <summary> ''' determine approx total width of inner controls ''' </summary> ''' <returns></returns> ''' <remarks></remarks> private function approxinnerwidth() integer dim returnval integer each ctl control in controlsflowlayoutpanel.controls returnval += ctl.width next return returnval end function private sub leftbutton_click(sender system.object, e system.eventargs) handles leftbutton.click 'scroll in 1/20th increments dim scrollval = approxinnerwidth() \ 20 if controlsflowlayoutpanel.horizontalscroll.value > scrollval controlsflowlayoutpanel.horizontalscroll.value = controlsflowlayoutpanel.horizontalscroll.value - scrollval end if end sub private sub rightbutton_click(sender system.object, e system.eventargs) handles rightbutton.click 'scroll in 1/20th increments dim scrollval = approxinnerwidth() \ 20 controlsflowlayoutpanel.horizontalscroll.value = controlsflowlayoutpanel.horizontalscroll.value + scrollval end sub
Comments
Post a Comment