How to display scroll bar for deckworkspace view

Topics: CAB & Smart Client Software Factory
Oct 25, 2007 at 12:08 AM
I use deckworkspace to display a usercontrol with many controls (such as datagrid, text box, combo boxes and buttons). The problem is that when the screen resolution is low, some controls are not visible or only part of the view is visible. I tried to set the usercontrol's AutoScoll property to True, but still there is no scroll bar when some parts of the view are not visible.

Is there any way to let the deckworkspace to display scroll bars when some parts of the view is not visible? Or should I use a different workspace?
Oct 25, 2007 at 12:49 AM
You can set your SmartPartl's AutoScroll to true and scrollbars will be displayed if the controls inside is larger then the SmartPart.
Oct 25, 2007 at 5:42 PM
Edited Oct 25, 2007 at 6:13 PM
I am not sure how to set SmartPart's AutoScroll to true. Here is what I tried:

MySmartPartView smartPart = WorkItem.SmartParts.AddNew<MySmartPart>();
smartPart.AutoScroll = true;  // I added this line for auto-scroll
... (show the vlew)

Here is my View class:

public partial class MySmartPartView : UserControl, IMySmartPart

As you can see the above codes, I added a line to set AutoScroll to true. However it still does not work when some controls inside the view are outside the current window.
Oct 25, 2007 at 7:17 PM
I think I figured out the problem. The suggestion (auto-scroll property) is right. However, I have a group-box as a frame for the user control. When the windows is resized, the group-box is also resized automatically. As a result, the scroll bar will never be displayed. After I removed the group-box control, the scroll bar is displayed. I think I have remove the outside group box control and use other alternative controls.
Oct 26, 2007 at 6:28 AM
You can keep the group box, but simply don't resize it, just keep it fit with your controls, and the smartpart (user control) will scroll the group box inside. This is the behavior of controls in .NET, not SCSF specific.
Oct 29, 2007 at 4:29 PM
Yes. You are right. What I did is to change the UserControl's AutoScroll to True and group box's dock to None. Make sure all the controls are contained in the group box in design mode. That solves the problem. In my project, there are many views and those property are not consistent. With the knowledge of above settings, all views can display scroll bar automatically. Thanks!