WEB开发网
开发学院软件开发C语言 C# 视频监控系列(15):总结贴——可能用到的C# Wi... 阅读

C# 视频监控系列(15):总结贴——可能用到的C# WinForm技术小结

 2009-04-08 08:25:34 来源:WEB开发网   
核心提示: 5. 全屏显示视频窗口 /// <summary> /// 全屏 /// </summary> /// <param name="tsmFullScreen">右键</param> /// <param name=

5.     全屏显示视频窗口

        /// <summary>
        /// 全屏
        /// </summary>
        /// <param name="tsmFullScreen">右键</param>
        /// <param name="pVideo">显示视频的窗口</param>
        /// <param name="cs">视频连接成功返回的值</param>
        private void FullScreen(ToolStripMenuItem tsmFullScreen, Panel pVideo, int cs)
        {
            if (this.WindowState == System.Windows.Forms.FormWindowState.Maximized)
            {
                tsmFullScreen.Text = "全屏窗口";
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
                this.WindowState = System.Windows.Forms.FormWindowState.Normal;
                this.TopMost = false;
                pVideo.Width = pre_Width;
                pVideo.Height = pre_Height;
                pVideo.Top = pre_Top;
                pVideo.Left = pre_Left;

                //隐藏其他控件
                HideOtherControls(pVideo, true);

                minPanel(pVideo, cs);
            }
            else
            {
                tsmFullScreen.Text = "关闭全屏";
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
                this.TopMost = true;

                pre_Width = pVideo.Width;
                pre_Height = pVideo.Height;
                pre_Top = pVideo.Top;
                pre_Left = pVideo.Left;

                pVideo.Width = this.Width;
                pVideo.Height = this.Height;
                pVideo.Top = 0;
                pVideo.Left = 0;

                //显示其他控件
                HideOtherControls(pVideo, false);
            }
        }

6.     其他代码

        //判断是不是IP地址
        public bool IsIPAddress(string ip)
        {
            return Regex.IsMatch(ip, @"^((2[0-4]d|25[0-5]|[01]?dd?).){3}(2[0-4]d|25[0-5]|[01]?dd?)$");
        }
        /// <summary>
        /// 是否是无符号整数(正数)
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public bool IsUInt(string value)
        {
            return Regex.IsMatch(value, @"^d*$");
        }

结束

实际开发中远不只这么多,基本上也是有一个这样的功能需求就去GOOGLE一段代码出来,还有其他如delegate和event在窗体之间使用,分屏也是简单的采用了4个Panel,当放大时就分别隐藏其他Panel等等,就不一一列举了,多查查资料就行了

上一页  1 2 3 

Tags:视频监控 系列 总结

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接