M
Mo
Hello all,
I m developing an application that has multiple forms for CF 2.0
smartphone
One of my forms will display network details, so I have about 15 labels
that will display network connection Information. These labels don't
fit into the same screen so I needed a vertical scroll bar.
I thought to change my labels into read-only TextBoxes (cause textboxes
have tab/index option that should work with auto-scrolling) But that
will put a grey box around the text box name (labels on CF don't have
this tab/index option)
So far I have experienced with 2 solutions, none of them seem to work
1) Auto scroll option on the form: I added all my controls (15
labels) into a panel
And added that panel to the form, then I enabled the Auto Scroll option
for the Form
Itself, the problem is that I can only scroll to the top/end of the
form (so I only see
The 1st 4/last 4 labels) and not the labels in-between, I scroll using
the dial pad/jog dialer
One post on the groups recommended checking for key down (then check
for the up key, the down key) And updating the Auto-Scroll property on
the form, I did that and I ended up with the same behavior when I press
the down key, it goes all the way down to the end of the form (not
gradually scrolling to show other labels), when i press the up key it
goes all the way to the top
http://groups.google.com/group/micr...8356?lnk=gst&q=scroll&rnum=3#b1c4e49bafbc8356
i added this code as the post recommended but i ended with the same
bevahior
<code>
private void NetworkDetails3_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == System.Windows.Forms.Keys.Up))
{
this.AutoScrollPosition = new
Point(this.AutoScrollPosition.X,
-this.AutoScrollPosition.Y - 12)
// Up
}
if ((e.KeyCode == System.Windows.Forms.Keys.Down))
{
this.AutoScrollPosition = new
Point(this.AutoScrollPosition.X,
-this.AutoScrollPosition.Y - 12)
}
......</code>
2) Added vertical scroll bar to the form and disabled the auto scroll
option: then I checked for
Key down event (then check for the up key, the down key) and then
re-drawing the panel itself where the labels are I did that, but its
very slow (I guess too much painting is going on) so the performance of
this solution is not accepted as well
This code below will do the job but its slow
<code>
if ((e.KeyCode == System.Windows.Forms.Keys.Down))
{
// Down
this.vScrollBar1.Value += 20; //each time I will move
my scroll bar about 20 pixels
this.panel1.Top = -this.vScrollBar1.Value;
this.panel1.Refresh(); //using panel1.Refresh() is lil
bit faster than .Update()
............
if ((e.KeyCode == System.Windows.Forms.Keys.Up))
{
// Up
this.vScrollBar1.Value -= 20;
this.panel1.Top = -this.vScrollBar1.Value;
this.panel1.Refresh();// .Update();// Update();
}
//this code doesnt seem to get executed, is it not valid for Smartphone
private void vScrollBar1_ValueChanged(object sender, EventArgs e)
{
//By decreasing the top y coordinate
//the contents panel appears to scroll
this.panel1.Top = -this.vScrollBar1.Value;
this.Update();
}
</code>
Appreciate your help on this
Regards
I m developing an application that has multiple forms for CF 2.0
smartphone
One of my forms will display network details, so I have about 15 labels
that will display network connection Information. These labels don't
fit into the same screen so I needed a vertical scroll bar.
I thought to change my labels into read-only TextBoxes (cause textboxes
have tab/index option that should work with auto-scrolling) But that
will put a grey box around the text box name (labels on CF don't have
this tab/index option)
So far I have experienced with 2 solutions, none of them seem to work
1) Auto scroll option on the form: I added all my controls (15
labels) into a panel
And added that panel to the form, then I enabled the Auto Scroll option
for the Form
Itself, the problem is that I can only scroll to the top/end of the
form (so I only see
The 1st 4/last 4 labels) and not the labels in-between, I scroll using
the dial pad/jog dialer
One post on the groups recommended checking for key down (then check
for the up key, the down key) And updating the Auto-Scroll property on
the form, I did that and I ended up with the same behavior when I press
the down key, it goes all the way down to the end of the form (not
gradually scrolling to show other labels), when i press the up key it
goes all the way to the top
http://groups.google.com/group/micr...8356?lnk=gst&q=scroll&rnum=3#b1c4e49bafbc8356
i added this code as the post recommended but i ended with the same
bevahior
<code>
private void NetworkDetails3_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == System.Windows.Forms.Keys.Up))
{
this.AutoScrollPosition = new
Point(this.AutoScrollPosition.X,
-this.AutoScrollPosition.Y - 12)
// Up
}
if ((e.KeyCode == System.Windows.Forms.Keys.Down))
{
this.AutoScrollPosition = new
Point(this.AutoScrollPosition.X,
-this.AutoScrollPosition.Y - 12)
}
......</code>
2) Added vertical scroll bar to the form and disabled the auto scroll
option: then I checked for
Key down event (then check for the up key, the down key) and then
re-drawing the panel itself where the labels are I did that, but its
very slow (I guess too much painting is going on) so the performance of
this solution is not accepted as well
This code below will do the job but its slow
<code>
if ((e.KeyCode == System.Windows.Forms.Keys.Down))
{
// Down
this.vScrollBar1.Value += 20; //each time I will move
my scroll bar about 20 pixels
this.panel1.Top = -this.vScrollBar1.Value;
this.panel1.Refresh(); //using panel1.Refresh() is lil
bit faster than .Update()
............
if ((e.KeyCode == System.Windows.Forms.Keys.Up))
{
// Up
this.vScrollBar1.Value -= 20;
this.panel1.Top = -this.vScrollBar1.Value;
this.panel1.Refresh();// .Update();// Update();
}
//this code doesnt seem to get executed, is it not valid for Smartphone
private void vScrollBar1_ValueChanged(object sender, EventArgs e)
{
//By decreasing the top y coordinate
//the contents panel appears to scroll
this.panel1.Top = -this.vScrollBar1.Value;
this.Update();
}
</code>
Appreciate your help on this
Regards