C# 全屏模式下,在vlc播放器上覆盖图片盒

C# 全屏模式下,在vlc播放器上覆盖图片盒,c#,winforms,overlay,vlc,C#,Winforms,Overlay,Vlc,我想在Windows窗体应用程序中以全屏模式显示VLC播放器前面的pictureBox `if(axVLCPlugin21.video.fullscreen == true) { Debug.WriteLine("Is fullscreen"); pictureBox2.BringToFront(); pictureBox2.Focus(); pictureBox2.Show();

我想在Windows窗体应用程序中以全屏模式显示VLC播放器前面的pictureBox

 `if(axVLCPlugin21.video.fullscreen == true)
        {
            Debug.WriteLine("Is fullscreen");
            pictureBox2.BringToFront();
            pictureBox2.Focus();
            pictureBox2.Show();
        }`
我尝试了这个方法和另一个使用Windows窗体弹出它的方法(),但它只出现在全屏后面


如果有人愿意分享他们的解决方案,我将不胜感激。

感谢@Jimi,他建议我使用hook方法,它运行良好,下面是我的代码,希望能帮助他人

public partial class Test : Form
{
    private IntPtr testPic;
    private IntPtr hWinEventHook;
    private Process Target;
    private WinApi.RECT rect = new WinApi.RECT();
    protected Hook.WinEventDelegate WinEventDelegate;

    public Test(Form toCover, AxAXVLC.AxVLCPlugin2 ply)
    {
        InitializeComponent();
        WinEventDelegate = new Hook.WinEventDelegate(WinEventCallback);

        this.SetTopLevel(true);
        this.TopMost = true;
        this.ControlBox = false;
        this.ShowInTaskbar = false;
        this.StartPosition = FormStartPosition.Manual;
        this.AutoScaleMode = AutoScaleMode.None;
        this.Show(toCover);
        toCover.Focus();

        try
        {
            Target = Process.GetProcessesByName("TestPlayer").FirstOrDefault(p => p != null);
            if (Target != null)
            {
                testPic = Target.MainWindowHandle;
                uint TargetThreadId = Hook.GetWindowThread(testPic);

                if (testPic != IntPtr.Zero)
                {

                    hWinEventHook = Hook.WinEventHookOne(Hook.SWEH_Events.EVENT_OBJECT_LOCATIONCHANGE,
                                                         WinEventDelegate,
                                                         (uint)Target.Id,
                                                         TargetThreadId);
                    rect = Hook.GetWindowRect(testPic);

                }

                if (ply.video.fullscreen == true) 
                {
                    Debug.WriteLine("yes is ");
                    this.WindowState = FormWindowState.Maximized;
                }
            }

        }
        catch (Exception e)
        {
            throw e;
        }
    }

    protected void WinEventCallback(IntPtr hWinEventHook,
                                Hook.SWEH_Events eventType,
                                IntPtr hWnd,
                                Hook.SWEH_ObjectId idObject,
                                long idChild,
                                uint dwEventThread,
                                uint dwmsEventTime)
    {
        if (hWnd == testPic &&
            eventType == Hook.SWEH_Events.EVENT_OBJECT_LOCATIONCHANGE &&
            idObject == (Hook.SWEH_ObjectId)Hook.SWEH_CHILDID_SELF)
        {
            WinApi.RECT rect = Hook.GetWindowRect(hWnd);
            //this.Location = new System.Drawing.Point(rect.Left, rect.Top);
        }
    }

    private void Overlay_FormClosing(object sender, FormClosingEventArgs e)
    {
        Hook.WinEventUnhook(hWinEventHook);
    }

    private void Overlay_FormShown(object sender, EventArgs e)
    {

        this.BeginInvoke(new Action(() => this.Owner.Activate()))
        this.Location = toCover.PointToScreen(System.Drawing.Point.Empty);
        if (Target == null)
        {
            this.Hide();
            MessageBox.Show("Player not found!", "Target Missing", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            this.Close();
        }
    }

    private const int DWMWA_TRANSITIONS_FORCEDISABLED = 3;
    [DllImport("dwmapi.dll")]
    private static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int value, int attrLen);

    private void Test_load(object sender, EventArgs e)
    {
        this.CenterToScreen();
        this.Location = new System.Drawing.Point(this.Location.X, this.Location.Y); 
    }

    private void closeFullScreen_Click_1(object sender, EventArgs e)
    {
        this.Close();
    }

}

这是一个太具体的问题,任何人都无法帮助您,而不需要在winforms中显示VLC ActiveX插件,播放视频,然后切换到全屏。当您尝试其他方法时,发生了什么?为什么他们不够好?您是否尝试过创建一个新表单,
form.TopMost=true
,将图片框放在那里?然后会发生什么?@Warty是的,我试过使用
from.TopMost=true
但仍然一样,它只出现在全屏后面。这是因为全屏不仅仅是一个无边界窗口,就像游戏劫持整个显示一样…@RonBeyer ya它劫持了整个显示,我找不到任何方法来劫持回来。