在WPF中实现水平滚动条/垂直滚动条 [英] Implementing Horizontal Scroll bar/Vertical Scroll bar in WPF
问题描述
大家好,
我在WPF应用程序(开发UI)中工作,我需要在启动时显示窗口以及一些内容(txt,image) ,但是内容/图像需要通过窗口调整大小来显示,即,我需要实现ScrollViewer功能,在窗口调整大小时显示内容,
另外,窗口应该拥有HSCROLL bar和VSCROLL吧,如何实现这两个功能,即ScrollViewer以及HSCROLL,VSCROLL。
< StackPanel 方向 = 水平 >
< 图片 名称 = ProductImage 宽度 = 32 高度 = 32 / >
< TextBlock 名称 = ProductText 保证金 = 5,0 FontSize = 24 宽度 = 392 / >
< / StackPanel >
< / Label >
< ScrollViewer 高度 = 203 VerticalScrollBarVisibility = 自动 Grid.Row = 1 保证金 = 5,5,5,5 >
< wfi:WindowsFormsHost 高度 = 333 >
< wf:DataGridView x:名称 = dataGridView1 >
< / wf:DataGridView >
< span class =code-keyword>< / wfi:WindowsFormsHost >
< / ScrollViewer >
我使用的是Windows 7 O / S,SP1& VS 2008 IDE
先谢谢。
有问候,
VishalK_91
几个小时前我回答了一个类似的(同样的)问题!
使用Scrollviewer实现滚动条(HSCROLL / VSCROLL) [ ^ ]
<击> 的 取值 的 撞击>
Hi All,
I am working in WPF application(developing UI), I need to display the window along with few contents(txt,image) during launch, but the contents/images needs to be displayed though window resizes, ie., I need to implement ScrollViewer feature, to display the contents on resize of window,
Also, In addition the window should possess HSCROLL bar and VSCROLL bar, how can one implement both features viz., ScrollViewer as well HSCROLL,VSCROLL.
<StackPanel Orientation="Horizontal">
<Image Name="ProductImage" Width="32" Height="32" />
<TextBlock Name="ProductText" Margin="5,0" FontSize="24" Width="392"/>
</StackPanel>
</Label>
<ScrollViewer Height="203" VerticalScrollBarVisibility="Auto" Grid.Row="1" Margin="5,5,5,5">
<wfi:WindowsFormsHost Height="333">
<wf:DataGridView x:Name="dataGridView1" >
</wf:DataGridView>
</wfi:WindowsFormsHost>
</ScrollViewer>
I am using Windows 7 O/S, SP1 & VS 2008 IDE
Thanks in Advance.
With Regards,
VishalK_91
I answered a similar (well the same) question a few hours ago!
Implementing Scrollbar(HSCROLL/VSCROLL) using Scrollviewer[^]
s
这篇关于在WPF中实现水平滚动条/垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!