如何删除滚动条
WPF
+ C#
+ Emgu CV
UI有一个滚动条,我对其进行了设置
capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 1024);
因为视频帧的高度和宽度大于UI的高度和宽度
private void OpenCv(ref VideoCapture capture, int index = 0)
{
if (capture == null)
{
capture = new VideoCapture(index);
if (capture.IsOpened)
{
capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.Autofocus,0);
capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 1024);//设置捕捉到帧的高度为320 Width="246" Height="210"
capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameWidth, 1024);//设置捕捉到帧的宽度为240
capture.FlipHorizontal = false;//捕捉到帧数据进行水平翻转
capture.ImageGrabbed += eventHandler;
capture.Start();
}
else
{
capture = null;
}
}
}
Xaml
<wfi:WindowsFormsHost ScrollViewer.VerticalScrollBarVisibility="Hidden"
HorizontalAlignment="Stretch" >
<emui:ImageBox Enabled="False"
AllowDrop="False"
AutoSize="True"
AutoScrollOffset="0,0"
x:Name="capturedImageBox"
Paint="CapturedImageBoxPaint" />
</wfi:WindowsFormsHost>
答案 0 :(得分:0)
如果尚未将WindowsFormsHost包裹在ScrollViewer中,则应将其包装在其标签内。
我的意思是
<ScrollViewer VerticalScrollBarVisibility="Hidden" ...>
<wfi:WindowsFormsHost ...>
//...
</wfi:WindowsFormsHost>
</ScrollViewer>