Simple way to create a scrollable panel?

corwin42

Expert
Licensed User
Longtime User
Hello,

is there a simple way to create a scrollable panel?

The idea is to create a settings panel with a few label and textbox controls. When the user enables the SIP the panel should resize to the space left on the form and a scrollbar should appear so that the user can scroll down to the lower controls.

Any chance to do this? You can see this in many PPC applications (The ASUS Wi-Fi Manager can do it for example).

Greetings,
Markus
 

willisgt

Active Member
Licensed User
I haven't actually written anything like this, but yes, it should be possible.

To start, you'll need to create a background panel.

Create a foreground panel and a scrollbar. Both should be created so the background panel is the parent, not the form. The width of the background panel should be enough to fit the foreground panel and scrollbar.

Write a sub to allow the scrollbar to reposition the foreground panel up and down ( panelForeground.Top = 0 - scrollbar1.Value ).

Write a routine to catch SIP panel opening and closing. You'll need the Hardware library for this. Resize the background panel and scrollbar, but leave the foreground panel height alone.

I'll see if I can whip up an example program real quick.


Gary
 

willisgt

Active Member
Licensed User
I think this is what you're talking about.
 

Attachments

  • example.sbp
    1.8 KB · Views: 550

corwin42

Expert
Licensed User
Longtime User
Hi!

I played around with this topic a bit more and found a much easier way with using the door.library and setting the AutoScale, Dock and Anchor properties of the controls.

Play around with the supplied simple example on the device. Switch SIP on and off and rotate the screen. The controls are moved and scaled correct automatically.

If you want to see this method in a real life application just look at my PDA TileManager


You can rotate the screen and switch on and off the SIP and you always have full access to all controls. The only limitation is that it needs .Net CF 2.0 or above.

It works really great.

Markus
 

Attachments

  • Rearrange.sbp
    2.3 KB · Views: 386

SonicSue

Member
Licensed User
I have been searching for just this solution you posted to address screen orientation problems when users pull out the keyboard on their device. My app wasn't rotating and remaining functional, but thanks to your 'rearrange' post, it is! Thanks! :sign0060:
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…