• devExpress panelcontrol 双击全屏


     devExpress panelcontrol 双击全屏的方法

            #region 初始化声明全屏
    
            [DllImport("user32.dll", SetLastError = true)]
            static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
    
            [DllImport("user32.dll", SetLastError = true)]
            static extern IntPtr GetDesktopWindow();
    
            [DllImport("user32.dll", SetLastError = true)]
            static extern IntPtr GetParent(IntPtr hWnd);
    
            [DllImport("user32.dll", SetLastError = true)]
            static extern int GetSystemMetrics(int nIndex);
    
            [DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
            public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
    
            [DllImport("User32.dll ", EntryPoint = "FindWindow")]
            private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
            public int SW_HIDE = 0;
            public int SW_RESTORE = 9;
    
            public bool m_bIsFullScreen = false;//判断是否全屏
            public bool m_bIsFillDock = false;//判断是否全容器
            Rectangle m_RecPanel1 = new Rectangle();//获取原始大小
    
    
            #endregion
            /// <summary>
            /// 双击全屏
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void pcDetailEditor_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                if (!m_bIsFullScreen)
                {
                    //获取桌面窗口并设置为父窗口
                    IntPtr hDesk = GetDesktopWindow();
                    SetParent(this.pcDetailEditor.Handle, hDesk);
    
                    int width = GetSystemMetrics(0);
                    int height = GetSystemMetrics(1);
    
                    this.pcDetailEditor.Dock = DockStyle.None;//这个很重要,Anchor属性仍可用
                    this.pcDetailEditor.Bounds = new Rectangle(new Point(0, 0), new Size(width, height));
                    ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE);//隐藏Windows任务栏
                    //ShowWindow(FindWindow("Button", null), SW_HIDE);
                    m_bIsFullScreen = true;
                }
                else
                {
                    //获取桌面窗口并设置为父窗口
                    IntPtr hDesk = GetDesktopWindow();
                    SetParent(this.pcDetailEditor.Handle, this.Handle);
    
                    int width = GetSystemMetrics(0);
                    int height = GetSystemMetrics(1);
                    this.pcDetailEditor.Dock = DockStyle.None;//这个很重要,Anchor属性仍可用
                    this.pcDetailEditor.Bounds = m_RecPanel1;
                    ShowWindow(FindWindow("Shell_TrayWnd", null), SW_RESTORE);//Shell_TrayWnd是任务栏的类名
                    m_bIsFullScreen = false;
                }
            }

     在Desiginer.cs中找到panelControl1,在最后加上

    this.panelControl1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.pcDetailEditor_MouseDoubleClick);
  • 相关阅读:
    微信小程序开发9-宿主环境(2)
    微信小程序开发8-小程序的宿主环境(1)
    微信小程序开发7-JavaScript脚本
    微信小程序开发6-WXSS
    点击底部input输入框,弹出的软键盘挡住input(苹果手机使用第三方输入法 )
    极光推送能获取 registrationId,但是接收不到通知
    App 运行后屏幕顶部和底部各留黑边问题
    App 分辨率相关
    配置隐私协议
    极光推送小结
  • 原文地址:https://www.cnblogs.com/damugua/p/15877824.html
Copyright © 2020-2023  润新知