Hi,
I am looking for some direction vis-a-vis a scrollable control (though no scroll bars - vertical or horizonal should be shown) - the development environment is VS-2005 (using C#). What I am trying to achieve is to develop a control that has an array of icons pasted across it (a single line of icons). At most there should be 3 icons visible at any time - hence a user can use the 5 way scroll button to go left and right within that control without having the main/parent form scroll.
By default, a list of 3 icons are displayed across the top - a user can press the right button on the device and the focus shifts to the next icon/object that is hidden (the control slides to the next object / icon - hence the next object is highlighted and made visible)
Example
object 1 object 2 object 3 | object 4 object 5 object 6
By default object 1,2 and 3 are visible, when i click on the right button once; object 2, 3 and 4 are visible (object 1 gets hidden).
Any help on this would be very helpful.
Thanks
Sid
Loading
Scott LyslePosted Jan 14, 2008, 7:21 PM
Sid:
You use two panels. Make one panel long enough to handle all of the icons/buttons, make the other smaller to accommodate only some of the icons. Place the longer panel with the buttons in it inside the smaller panel. Your left/right buttons would then be used to move the panel left or right to expose a different section of the icons/buttons.
If the buttons were 27 wide, you would make your calls something like this:
private void btnMoveLeft_Click(object sender, EventArgs e) { panel2.Left -= 27; } private void btnMoveRight_Click(object sender, EventArgs e) { panel2.Left += 27; }You'd also want to limt the travel of the larger panel by checking the present left position against some limit, if the longer panel hits the left or right limit you cold ignore commands to drive the panel farther left or right.
You might also want to consider instead using the toolstrip contain along with a toolstrip. You could plane your controls into the toolstrip and put the toolstrip into the container. If the user resizes the form such that some of the controls are no longer visible, the container displays an arrow at the end of the toolstrip; if the user clicks the arrow, the remainder of the controls (not visible) are displayed in a drop down.