0

我目前正在开发一个界面,显示多个相机镜头和相机的直接视图。

我需要做的是在图片框上贴一个标签(每帧刷新相机的图片框)。

我的问题是,当图片框刷新时,标签会在它下面。

以下是我的 XAML 代码的制作方式:

<Grid x:Name="GridCam4" Grid.Column="1" Grid.Row="1" Margin="0,0,24,0">
                
                    <WindowsFormsHost x:Name="DisplayWindow" Foreground="#FFA0A0A0" Background="#FFA0A0A0" Panel.ZIndex="2" Height="435" Width="678">
                        <forms:PictureBox x:Name="picturebox1" BackgroundImageLayout="None"/>
                    </WindowsFormsHost>
                
                <Label x:Name="LabelLive" Content="Live :" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="102" Width="206" FontSize="36" Panel.ZIndex="12" Foreground="White"/>
</Grid>

还有我的 C# 代码:

private void onFrameEvent(object sender, EventArgs e)
    {
        uEye.Camera Camera = sender as uEye.Camera;

        Camera.Memory.GetLast(out s32MemID);
        
        //Display the image on the screen (Refresh the picturebox with last picture taken)

        Camera.Display.Render( DisplayHandle, uEye.Defines.DisplayRenderMode.FitToWindow);
         Camera.Memory.Unlock(s32MemID);

        
        this.Dispatcher.Invoke(
              new Action(() =>
              {
                  LabelLive.Content = "Live :";  //Trying to refresh the label to put it over  picturebox
              }),
              DispatcherPriority.ApplicationIdle);
    }

我真的不知道该怎么处理这个......

我也尝试过 ZPanels,但目前没有任何效果。

谢谢你的帮助 !

4

0 回答 0