Log in

View Full Version : VB.NET APP for PPC 2003 - adding scroll bars


pdanford
02-02-2005, 04:20 PM
Hi,

I am developing an application for a PPC 2003 device using VB.NET.

Because screen space is very limited, I am wanting to add scroll bars to a number of forms used to display data (both horizontal & vertical).

Could anyone point me in the right direction?

Any advice/tips appreciated.

Many thanks,
pd

GSmith
02-02-2005, 05:25 PM
Some text controls have scrollbars automatically when you set the properties correctly (the ScrollBars property).

Or you can derive your own control and add ScrollBars:

Most controls that need scroll bars already provide them and do not require this control. This is true of a multiline TextBox control, a ListBox, and a ComboBox, for example.

You can use this control to implement scrolling in containers that do not provide their own scroll bars such as a PictureBox or for user input of numeric data. The numeric data can be displayed in a control or used in code. The Minimum and Maximum properties determine the range of values the user can select. The LargeChange property determines the effect of clicking within the scroll bar but outside the scroll box. The SmallChange property determines the effect of clicking the scroll arrows at each end of the control.


More info at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsscrollbarclasstopic.asp

pdanford
02-03-2005, 12:34 PM
Thanks for your reply.

Rather than implementing scroll bars on individual controls, is it possible for the Form itself to have scroll bars - this is available in a standard VB.NET exe by enabling the Form property AutoScroll

Many thanks,
pd

GSmith
02-03-2005, 02:06 PM
According to: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsformclassautoscrolltopic.asp

the AutoScroll property is not available on the Compact Framework (note the lack of the listing of Compact Framework in the "Requirements: Platforms:" section.

I don't see anything in IntelliSense or VS.NET 2003 design mode that would indicate any scroll bars. I could be wrong, but I don't see it off hand.

deniro1
02-04-2005, 04:22 PM
I have been doing an app and needed this type of thing, a scrollable form. The forms in the .Net framework don't have an integrated scrollbar property like a regular .Net form would for autoscroll or whatever.
I found some sample code and had to basically fake it, with a panel control and a scrollbar next to it, where the scrollbar would adjust the position of the panel. The panel's height was set to be larger than the screen, so the 'overflow' was hidden above/below the actual screen as it was scrolled.

Let me see if I can find the code ...
Try setting the height of the panel to higher than the screen. The scrollbar's ValueChanged event changes the panel's TOP prop. by ( -1 * scrollbar.value), basically pushing it up or down, opposite the scrollbar change.
You can then set the scrollbar's maximum to the panel's real height minus it's visible height. So, if only 200 pixels are visible, but the panel is 250 high, then the scrollbar would only scroll a maximum of 50.

It's kind of messy, but I hope you get the idea of what I am trying to say. If not, let me know and I'll try to rephrase it to make better sense.

pdanford
02-08-2005, 02:33 PM
Thanks for your replies.

I think I have found the sample code you were referring to:

http://samples.gotdotnet.com/quickstart/CompactFramework/doc/scrolling.aspx

This is giving me the behavoir I was after.

Thanks again.