如何去掉Emgu CV UI ImageBox的滚动条
How to remove Emgu CV UI ImageBox the scroll bar
如何去掉滚动条
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>
如果您尚未将 WindowsFormsHost 包装在 ScrollViewer 中,则应将其包装在 ScrollViewer 中,并在其标签内设置其属性。
我是说;
<ScrollViewer VerticalScrollBarVisibility="Hidden" ...>
<wfi:WindowsFormsHost ...>
//...
</wfi:WindowsFormsHost>
</ScrollViewer>
如何去掉滚动条
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>
如果您尚未将 WindowsFormsHost 包装在 ScrollViewer 中,则应将其包装在 ScrollViewer 中,并在其标签内设置其属性。
我是说;
<ScrollViewer VerticalScrollBarVisibility="Hidden" ...>
<wfi:WindowsFormsHost ...>
//...
</wfi:WindowsFormsHost>
</ScrollViewer>