I am new to the .Net
Compact Framework and have been unable to find an answer via Google. Gasp! Yes, it's true, but that is part of why * is here, right?
我是.Net Compact Framework的新手,无法通过Google找到答案。喘气!是的,这是真的,但这是*在这里的原因之一,对吧?
I have a form that is longer than the screen, so a vertical scroll-bar appears as expected. However, this appears to force a horizontal scroll-bar to appear as well. (If I scroll to the right, there is nothing visible except white space ... about the size of a scroll-bar.)
我有一个比屏幕长的表单,所以垂直滚动条按预期显示。但是,这似乎也会强制显示水平滚动条。 (如果我向右滚动,除了空格之外没有任何可见的...关于滚动条的大小。)
Is this a "feature" that is unavoidable? Anyone have experience in this area?
这是一个不可避免的“特征”吗?有人在这方面有经验吗?
3 个解决方案
#1
2
Place your controls within a panel or equivalent and then reduce the width of the panel by the size of a vertical scrollbar. That means that when the vertical scrollbar appears then it will no longer require the horizontal scrollbar to make up for the lost width that the vertical scrollbar took.
将控件放在面板或等效面板中,然后按垂直滚动条的大小减小面板的宽度。这意味着当出现垂直滚动条时,它将不再需要水平滚动条来弥补垂直滚动条所占用的丢失宽度。
#2
2
You need to use the Anchor attribute on the controls.
Make the control Anchored to the Top, Left and Right.
您需要在控件上使用Anchor属性。使控件锚定到顶部,左侧和右侧。
When the form requires the vertical scrollbar the controls will resize instead of using the horizontal scrollbar.
当表单需要垂直滚动条时,控件将调整大小而不是使用水平滚动条。
Also you may find it easier to put all the controls into a Panel. Make the Panel the first control you add to your form.
Make the panel as big as the form, or lower than the bottom of the form is you need more space.
Set the anchor to Top, Left, Right. Set the autoscroll to true. On the Form turn autoscroll off.
此外,您可能会发现将所有控件放入Panel更容易。使Panel成为您添加到表单的第一个控件。使面板与表单一样大,或者低于表单底部是否需要更多空间。将锚点设置为“上”,“左”,“右”。将autoscroll设置为true。在窗体上关闭自动滚动。
Now put the controls into the Panel. You still need to set the anchor points on each of your controls or your Panel control will use the horizontal scrollbar and make the whole exercise pointless.
This is a good technique when you need to use the SIP(Soft Input Panel) as the Panels Height attribute can be altered when the SIP.Enabled attribute changes and prevents some of the controls being hidden by the SIP - it is annoying having to write text in a Textbox that you can't see.
The panel will provide the scrollbar as needed.
现在将控件放入Panel中。您仍需要在每个控件上设置锚点,否则Panel控件将使用水平滚动条并使整个练习毫无意义。当您需要使用SIP(软输入面板)时,这是一种很好的技术,因为当SIP.Enabled属性发生变化时可以更改Panels Height属性并阻止某些控件被SIP隐藏 - 这很烦人不得不写您无法看到的文本框中的文本。该面板将根据需要提供滚动条。
I'd say it is a good idea to put all controls in a Panel on the Form as adding it later can be a pain in the arse if the SIP is required later.
我想说将所有控件放在Form上的Panel中是一个好主意,因为如果以后需要SIP,稍后添加它可能会很麻烦。
#3
0
Yes - I've got experience with that - unfortunately it was no different from your own. I've generally avoided scrolling forms and used paging wherever possible on .Net CF. If this is an option for you, I'd recommend it.
是的 - 我有经验 - 不幸的是,这与你自己没有什么不同。我一般都避免滚动表单,并尽可能在.Net CF上使用分页。如果这是你的选择,我会推荐它。
I'd assume the scroll bar issue is to do with the form size being fixed to the width of the available screen (regardless of design-time settings) so the introduction of a vertical scroll bar obscures part of the (not needed) full-width form.
我假设滚动条问题与表格大小固定在可用屏幕的宽度有关(无论设计时间设置如何),因此引入垂直滚动条会遮挡部分(不需要的) - 宽度形式。
#1
2
Place your controls within a panel or equivalent and then reduce the width of the panel by the size of a vertical scrollbar. That means that when the vertical scrollbar appears then it will no longer require the horizontal scrollbar to make up for the lost width that the vertical scrollbar took.
将控件放在面板或等效面板中,然后按垂直滚动条的大小减小面板的宽度。这意味着当出现垂直滚动条时,它将不再需要水平滚动条来弥补垂直滚动条所占用的丢失宽度。
#2
2
You need to use the Anchor attribute on the controls.
Make the control Anchored to the Top, Left and Right.
您需要在控件上使用Anchor属性。使控件锚定到顶部,左侧和右侧。
When the form requires the vertical scrollbar the controls will resize instead of using the horizontal scrollbar.
当表单需要垂直滚动条时,控件将调整大小而不是使用水平滚动条。
Also you may find it easier to put all the controls into a Panel. Make the Panel the first control you add to your form.
Make the panel as big as the form, or lower than the bottom of the form is you need more space.
Set the anchor to Top, Left, Right. Set the autoscroll to true. On the Form turn autoscroll off.
此外,您可能会发现将所有控件放入Panel更容易。使Panel成为您添加到表单的第一个控件。使面板与表单一样大,或者低于表单底部是否需要更多空间。将锚点设置为“上”,“左”,“右”。将autoscroll设置为true。在窗体上关闭自动滚动。
Now put the controls into the Panel. You still need to set the anchor points on each of your controls or your Panel control will use the horizontal scrollbar and make the whole exercise pointless.
This is a good technique when you need to use the SIP(Soft Input Panel) as the Panels Height attribute can be altered when the SIP.Enabled attribute changes and prevents some of the controls being hidden by the SIP - it is annoying having to write text in a Textbox that you can't see.
The panel will provide the scrollbar as needed.
现在将控件放入Panel中。您仍需要在每个控件上设置锚点,否则Panel控件将使用水平滚动条并使整个练习毫无意义。当您需要使用SIP(软输入面板)时,这是一种很好的技术,因为当SIP.Enabled属性发生变化时可以更改Panels Height属性并阻止某些控件被SIP隐藏 - 这很烦人不得不写您无法看到的文本框中的文本。该面板将根据需要提供滚动条。
I'd say it is a good idea to put all controls in a Panel on the Form as adding it later can be a pain in the arse if the SIP is required later.
我想说将所有控件放在Form上的Panel中是一个好主意,因为如果以后需要SIP,稍后添加它可能会很麻烦。
#3
0
Yes - I've got experience with that - unfortunately it was no different from your own. I've generally avoided scrolling forms and used paging wherever possible on .Net CF. If this is an option for you, I'd recommend it.
是的 - 我有经验 - 不幸的是,这与你自己没有什么不同。我一般都避免滚动表单,并尽可能在.Net CF上使用分页。如果这是你的选择,我会推荐它。
I'd assume the scroll bar issue is to do with the form size being fixed to the width of the available screen (regardless of design-time settings) so the introduction of a vertical scroll bar obscures part of the (not needed) full-width form.
我假设滚动条问题与表格大小固定在可用屏幕的宽度有关(无论设计时间设置如何),因此引入垂直滚动条会遮挡部分(不需要的) - 宽度形式。