Left Side Vertical Scroll Bar in Window CE Form
Dear Viewers I didn't find any other alternate except below to set Vertical scroll bar at Left side.
For the Arabic screens & others we will to have such requirement as I had.
Of course for Windows/Web Apps we have many alternates and may techniques to implement such but coming to Window CE 5.0/6.0 this below Logical approach worked for me.
1) Drag the Panel and adjust it so that width is occupied to full form and height should be as per your convenient.(for me I set panel width=220 & height =440), this width of panel gives me some space (20) at left side for vertical scroll bar.
2) Drag the VScrollBar control at left side of your form and adjust its width and height so that it should fix in the width of 20 and height of the form, you need to set proper MaxValue as per your panel height I set my vScrollbar MaxValue property as 115 and MinValue must be always 0.
(Note: Its around 440 x 0.2613636363636364 = 115 (remember it as formula vscrollbarMaxValue = panelsize x 0.2613636363636364))
3) Call value changed event of vScrollbar
this.vScrollBar1.ValueChanged += new System.EventHandler(this.vScrollBar1_ValueChanged);
4) very Small logic I have written inside the Even, thats it..Hurray enjoy it
int
previousValue=0; //used for scrolling panel
up/down with respect to scroll bar
private
void vScrollBar1_ValueChanged(object sender, EventArgs
e)
{
int
currentValue = vScrollBar1.Value;
if
(previousValue < currentValue) //for down
{
panel2.Location = new Point(panel2.Location.X,
- (currentValue+ pnlIcons.Height));
}
else //for up
{
panel2.Location = new Point(panel2.Location.X,
panel2.Location.Y - (panel2.Location.Y + currentValue));
}
previousValue = currentValue;
feel free to write your suggestions or comments about it..
No comments:
Post a Comment