C〓〓のフォームのプログラムはフルスクリーンを実現してとフルスクリーンの措置をキャンセルします。


プロジェクトが必要なので、ビデオを再生するウィンドウのフルスクリーンとフルスクリーンをvsフォームプログラムで実現する必要があります。
具体的な実現インターフェースは図のようです。


これは初期状態です。ビデオボックスの右上の角がフルスクリーンを制御するボタンです。
これはフルスクリーン後の状態です。全画面ボタンはフルスクリーンをキャンセルする形になります。
注:画面の美しさのために、画面全体が左のコントロールを覆っていませんが、設定できるものです。下のコード部分は説明します。
まず、私が使っているコントロールと私のプロジェクトのコントロールの名前を説明します。
ビデオを表示する黒い枠はpictureboxというコードの中のVideoPlayWndで、フルスクリーン/キャンセルは一つのbuttonつまりコードの中のbutton 4です。
2、具体的なコードは以下の通りです。
フルスクリーンとキャンセルはボタン一つです。

private Int16 zoom = -1;//       button4   ,           
 //         
  private void button4_Click(object sender, EventArgs e)
  {
   if(zoom<0)
   {
    float w = this.Width - 210; //                 210
    float h = this.Height - 50;//           ,      ,    50
    this.VideoPlayWnd.Size = Size.Ceiling(new SizeF(w, h));//          picturebox     
    VideoPlayWnd.Location = new System.Drawing.Point(210, 0);//         ,          210  (               )
    button4.Location = new System.Drawing.Point(795, 0);//    picturebox  ,  button             ,        
    // button4.BackgroundImage = Image.FromFile(@"E:\lwj\addpersoninfo\addpersoninfo\Resources\    .png");//    (          )
    button4.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + @"    .png");//AppDomain.CurrentDomain.BaseDirectory             bin  ,              
    zoom = 1;//    ,         ,     zoom  
   }
   else
   { //       ,            ,        ,       
    VideoPlayWnd.Location = new System.Drawing.Point(495, 360);
    this.VideoPlayWnd.Size = Size.Ceiling(new SizeF(323, 271));
    button4.Location = new System.Drawing.Point(795, 360);
    button4.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + @"  .png");
    zoom = -1;//              ,      -1(    0,        if  )
   }
  }
以上のコードのボタンはフルスクリーンの背景画像を追加し、クリックした時に背景画像を切り替えます。
補足知識:C〓〓フォームのビデオコントロールはフルスクリーンモードに入り、フルスクリーンモードから退出します。
フォームコントロールはフルスクリーンモードに入り、フルスクリーンモードを終了します。ビデオ再生時にはこの機能を使います。
ツールコード

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace CvNetVideo.Play
{
 class FullScreenHelper
 {
  bool m_bFullScreen = false;
  IntPtr m_OldWndParent = IntPtr.Zero;
  WINDOWPLACEMENT m_OldWndPlacement = new WINDOWPLACEMENT();
  Control m_control = null;
 
  public FullScreenHelper(Control c)
  {
   m_control = c;
  }
  struct POINT
  {
   int x;
   int y;
  };
  struct RECT
  {
   public int left;
   public int top;
   public int right;
   public int bottom;
  };
  //      ,     。               。      ,     。               
  [DllImport("User32.dll")]
  public static extern bool LockWindowUpdate(IntPtr hWndLock);
 
  //          ,            。                 
  [DllImport("User32.dll")]
  public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
 
  //                ,   ,     。    :      
  [DllImport("User32.dll")]
  public static extern bool SetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
 
  //                 ,       。         ,            
  [DllImport("User32.dll")]
  public static extern bool SetForegroundWindow(IntPtr hWnd);
 
  //            。          。                          
  [DllImport("User32.dll")]
  public static extern IntPtr GetDesktopWindow();
 
  //   。                    、             
  [DllImport("User32.dll")]
  public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
 
  //                             
  [DllImport("User32.dll")]
  public static extern int GetSystemMetrics(int nIndex); 
 
  [DllImport("user32.dll", EntryPoint = "GetParent", SetLastError = true)]
  public static extern IntPtr GetParent(IntPtr hWnd);
  [DllImport("user32.dll", CharSet = CharSet.Auto)]
  public static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);
  [DllImport("user32.dll", CharSet = CharSet.Auto)]
  public static extern System.IntPtr GetForegroundWindow();
  [DllImport("user32")]
  public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
  [DllImport("user32.dll")]
  public static extern uint ScreenToClient(IntPtr hwnd, ref POINT p);
   public void FullScreen(bool flag)
  {
   m_bFullScreen = flag;
   if (!m_bFullScreen)
   {
    LockWindowUpdate(m_control.Handle);
    SetParent(m_control.Handle, m_OldWndParent);
    SetWindowPlacement(m_control.Handle, ref m_OldWndPlacement);
    SetForegroundWindow(m_OldWndParent);
    LockWindowUpdate(IntPtr.Zero);
   }
   else
   {
    GetWindowPlacement(m_control.Handle, ref m_OldWndPlacement);
    int nScreenWidth = GetSystemMetrics(0);
    int nScreenHeight = GetSystemMetrics(1);
    m_OldWndParent = GetParent(m_control.Parent.Handle);
    SetParent(m_control.Handle, GetDesktopWindow());
    WINDOWPLACEMENT wp1 = new WINDOWPLACEMENT();
    wp1.length = (uint)Marshal.SizeOf(wp1);
    wp1.showCmd = 1;
    wp1.rcNormalPosition.left = 0;
    wp1.rcNormalPosition.top = 0;
    wp1.rcNormalPosition.right = nScreenWidth;
    wp1.rcNormalPosition.bottom = nScreenHeight;
    SetWindowPlacement(m_control.Handle, ref wp1);
    SetForegroundWindow(GetDesktopWindow());
    SetForegroundWindow(m_control.Handle);
   }
   m_bFullScreen = !m_bFullScreen;
  }
  struct WINDOWPLACEMENT
  {
   public uint length;
   public uint flags;
   public uint showCmd;
   public POINT ptMinPosition;
   public POINT ptMaxPosition;
   public RECT rcNormalPosition;
  };
 }
}
呼び出し方式

 /// <summary>
  ///     
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void UCVideo_DoubleClick(object sender, EventArgs e)
  {
   //    
   //sdlVideo.SDL_MaximizeWindow();
   fullScreenHelper = new CvNetVideo.Play.FullScreenHelper(this);
   fullScreenHelper.FullScreen(true);
   Console.WriteLine("Entrance FullScreen Mode");
  }
  /// <summary>
  ///       
  /// </summary>
  private void UCVideo_KeyUp(object sender, KeyEventArgs e)
  {
   // ESC     
   if (e.KeyCode == Keys.Escape&& fullScreenHelper!=null)
   {
    fullScreenHelper.FullScreen(false);
    fullScreenHelper = null;
    Console.WriteLine("Exit FullScreen Mode");
   }   
  }
テストの効果図


注意:SDLを使ったフルスクリーン操作では設定が無効で、動画再生中に変更ができません。コードは以下の通りです

public void SDL_MaximizeWindow()
  {
   Console.WriteLine("    ");
 
   SDL.SDL_MaximizeWindow(screen);
   SDL.SDL_SetWindowFullscreen(screen, SDL.SDL_GetWindowFlags(screen));
   SDL.SDL_ShowWindow(screen);
 
   //int width, height;
           
   //SDL2.SDL.SDL_GetWindowMaximumSize(screen, out width, out height);
           
   //if (width>0&&height>0)
   //{
   // SDL2.SDL.SDL_SetWindowMaximumSize(screen, width, height);
   // Console.WriteLine("    ......  !width=" + width + ",height=" + height);
   //}
   //else
   //{
   // Console.WriteLine("    ......  !width=" + width + ",height=" + height);
   // SDL2.SDL.SDL_SetWindowMaximumSize(screen, w, h);
   //}
  }
ツールコード機能の改善

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace CvNetVideo.Play
{
 /// <summary>
 ///        
 /// </summary>
 public abstract class FullScreenObject
 {
  public abstract void FullScreen(bool flag);
 }
 /// <summary>
 ///     
 /// </summary>
 public unsafe class FullScreenHelper: FullScreenObject
 {
  bool m_bFullScreen = false;
 
  WINDOWPLACEMENT m_OldWndPlacement = new WINDOWPLACEMENT();
 
  UCVideo m_control = null;
 
  public FullScreenHelper(UCVideo control)
  {
   m_control = control;
  }
 
  private IntPtr m_OldWndParent = IntPtr.Zero;
 
  DockStyle old_docker_style;
  int old_left;
  int old_width;
  int old_height;
  int old_top;
 
  public override void FullScreen(bool flag)
  {
   m_bFullScreen = flag;
   if (!m_bFullScreen)
   {
    #region    :           ,    IE        
    //ShellSDK.LockWindowUpdate(m_control.Handle);
    //ShellSDK.SetParent(m_control.Handle, m_OldWndParent);
    //ShellSDK.SetWindowPlacement(m_control.Handle, ref m_OldWndPlacement);
    //ShellSDK.SetForegroundWindow(m_OldWndParent);
    //ShellSDK.LockWindowUpdate(IntPtr.Zero);
    #endregion
 
    #region    :            ,    IE        
    //       
    m_control.Dock = old_docker_style;
    m_control.Left = old_left;
    m_control.Top = old_top;
    m_control.Width = old_width;
    m_control.Height = old_height;
    ShellSDK.SetParent(m_control.Handle, m_OldWndParent);
    #endregion
   }
   else
   {
    #region    :           ,    IE        
    //ShellSDK.GetWindowPlacement(m_control.Handle, ref m_OldWndPlacement);
    //int nScreenWidth = ShellSDK.GetSystemMetrics(0);
    //int nScreenHeight = ShellSDK.GetSystemMetrics(1);
    //m_OldWndParent = ShellSDK.GetParent(m_control.Handle);
    //ShellSDK.SetParent(m_control.Handle, ShellSDK.GetDesktopWindow());
    //WINDOWPLACEMENT wp1 = new WINDOWPLACEMENT();
    //wp1.length = (uint)Marshal.SizeOf(wp1);
    //wp1.showCmd = 1;
    //wp1.rcNormalPosition.left = 0;
    //wp1.rcNormalPosition.top = 0;
    //wp1.rcNormalPosition.right = Screen.PrimaryScreen.Bounds.Width/*nScreenWidth*/;
    //wp1.rcNormalPosition.bottom = Screen.PrimaryScreen.WorkingArea.Height/* nScreenHeight*/;
    //ShellSDK.SetWindowPlacement(m_control.Handle, ref wp1);
    //ShellSDK.SetForegroundWindow(ShellSDK.GetDesktopWindow());
    //ShellSDK.SetForegroundWindow(m_control.Handle);
    #endregion
 
    #region    :            ,    IE        
    //        
    old_docker_style = m_control.Dock;
    old_left = m_control.Left;
    old_width = m_control.Width;
    old_height = m_control.Height;
    old_top = m_control.Top;
    m_OldWndParent = ShellSDK.GetParent(m_control.Handle);
    //       
    int nScreenWidth = ShellSDK.GetSystemMetrics(0);
    int nScreenHeight = ShellSDK.GetSystemMetrics(1);
    m_control.Dock = DockStyle.None;
    m_control.Left = 0;
    m_control.Top = 0;
    m_control.Width = nScreenWidth;
    m_control.Height = nScreenHeight;
    ShellSDK.SetParent(m_control.Handle, ShellSDK.GetDesktopWindow());
    ShellSDK.SetWindowPos(m_control.Handle, -1, 0, 0, m_control.Right - m_control.Left, m_control.Bottom - m_control.Top, 0);
    #endregion
   }
   m_bFullScreen = !m_bFullScreen;
  }
 
 }
 
 /// <summary>
 ///        
 /// </summary>
 public class FullScreenInContainerHelper : FullScreenObject
 {
  bool m_bFullScreen = false;
 
  Control m_control = null;
 
  public FullScreenInContainerHelper(Control control)
  {
   m_control = control;
  }
 
  private IntPtr m_OldWndParent = IntPtr.Zero;
  private IntPtr m_father_hwnd;
  private RECT m_rect = new RECT();
 
  public override void FullScreen(bool flag)
  {
   m_bFullScreen = flag;
   if (!m_bFullScreen)
   {
    ShellSDK.SetParent(m_control.Handle, m_father_hwnd);
    ShellSDK.SetWindowPos(m_control.Handle, 0, m_rect.left, m_rect.top, m_rect.right - m_rect.left, m_rect.bottom - m_rect.top, 0);
    ShellSDK.SetForegroundWindow(m_father_hwnd);
   }
   else
   {
    m_father_hwnd = ShellSDK.GetParent(m_control.Handle);
    ShellSDK.GetWindowRect(m_control.Handle, out RECT rect);
    POINT pt = new POINT();
    pt.x = rect.left;
    pt.y = rect.top;
    ShellSDK.ScreenToClient(m_father_hwnd, ref pt);
    rect.right = rect.right - rect.left + pt.x;
    rect.bottom = rect.bottom - rect.top + pt.y;
    rect.left = pt.x;
    rect.top = pt.y;
    m_rect = rect;
    ShellSDK.GetWindowRect(m_father_hwnd, out RECT rect_fature);
    ShellSDK.SetWindowPos(m_control.Handle, 0, 0, 0, rect_fature.right - rect_fature.left, rect_fature.bottom - rect_fature.top, 0);
   }
   m_bFullScreen = !m_bFullScreen;
  }
 }
 
 /// <summary>
 /// Windows  API-SDK
 /// </summary>
 public class ShellSDK
 {
  //      ,     。               。      ,     。               
  [DllImport("User32.dll")]
  public static extern bool LockWindowUpdate(IntPtr hWndLock);
 
  //          ,            。                 
  [DllImport("User32.dll")]
  public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
 
  //                ,   ,     。    :      
  [DllImport("User32.dll")]
  public static extern bool SetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
 
  //                 ,       。         ,            
  [DllImport("User32.dll")]
  public static extern bool SetForegroundWindow(IntPtr hWnd);
 
  //            。          。                          
  [DllImport("User32.dll")]
  public static extern IntPtr GetDesktopWindow();
 
  //   。                    、             
  [DllImport("User32.dll")]
  public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
 
  //                             
  [DllImport("User32.dll")]
  public static extern int GetSystemMetrics(int nIndex); 
 
  [DllImport("user32.dll", EntryPoint = "GetParent", SetLastError = true)]
  public static extern IntPtr GetParent(IntPtr hWnd);
  [DllImport("user32.dll", CharSet = CharSet.Auto)]
  public static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);
  [DllImport("user32.dll", CharSet = CharSet.Auto)]
  public static extern System.IntPtr GetForegroundWindow();
  [DllImport("user32")]
  public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
  [DllImport("user32.dll")]
  public static extern uint ScreenToClient(IntPtr hwnd, ref POINT p);
 }
 
 /// <summary>
 ///       
 /// </summary>
 public struct RECT
 {
  public int left;
  public int top;
  public int right;
  public int bottom;
 }
 
 /// <summary>
 ///       
 /// </summary>
 public struct POINT
 {
  public int x;
  public int y;
 }
 
 /// <summary>
 ///       
 /// </summary>
 public struct WINDOWPLACEMENT
 {
  public uint length;
  public uint flags;
  public uint showCmd;
  public POINT ptMinPosition;
  public POINT ptMaxPosition;
  public RECT rcNormalPosition;
 }
}
以上のC〓〓のフォームのプログラムは全画面を実現して、全スクリーンの措置をキャンセルしますと、小さい編集がみんなのすべての内容に分かち合うので、みんなに1つの参考をあげることができることを望んで、みんながよけいに私達を支持することをも望みます。