开发者

WindowsForm Picturebox in WPF

I found this cool application which lets you have a webcam connection with your home network but it uses a PictureBox to show the webcam stream.

I got a PictureBox to work in WPF, but it doesn't seem to resize.

Example: http://i.stack.imgur.com/mpEsN.png

What am I doing wrong?

This is my current XAML Code:

<Grid>
    <wfi:WindowsFormsHost>
        <winForms:PictureBox  x:Name="pictureBoxLoading">
    开发者_StackOverflow中文版    </winForms:PictureBox>
    </wfi:WindowsFormsHost>
</Grid>


I assume in your code you're not using native WPF Image control. Any native WPF control can automatically resize when included in a grid or in a Viewbox.

Because you're using Windows Forms control, you have to handle the resize yourself, because WindowsFormsHost only host Windows Forms control, NOT interacting with it as a normal WPF control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜