trend Posted May 8, 2005 Posted May 8, 2005 Hello, I have created a program that makes a lot of buttons inside a panel that is inside a panel. The reason for a panel inside a panel is so the user can have an up/down button to scroll and see all the buttons. My issue is with the down button.. knowing when to stop allowing the user to go down (making it so when the user scrolls down... he cannot keep scrolling past the last button...) my buttons are space 151 pixels from the start of one button to the start of the next... and they are 4 wide (that is why i divide by 4 in the equation).. Private Sub btnDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDown.Click If TotalButtons / 4 * 151 > -(Me.ButtonPanel.Top * 2) Then MsgBox(TotalButtons / 4 * 151 & " " & Me.ButtonPanel.Top * 2) Me.ButtonPanel.Top = Me.ButtonPanel.Top - 151 End If End Sub The me.buttonpanel.top dimensions are static (like 3000x600 or something like that)... thanks for any help! Pigeon Quote
Machaira Posted May 9, 2005 Posted May 9, 2005 Why not just do something like: If buttonpanel.Top > -(buttonpanel.Height - 151) Then 'allow scrolling End If You shouldn't even need to worry about how many buttons there are, just the size of the panel that contains them. Quote Here's what I'm up to.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.