Example #1
0
        public RealPlayerGrid(PlayerManager mgr, int row, int column)
        {
            this.RowCount    = row;
            this.ColumnCount = column;

            // 设置行属性
            float rowHeight   = 100 / row;
            float columnWidth = 100 / column;

            for (int i = 0; i < row; i++)
            {
                RowStyles.Add(new RowStyle(SizeType.Percent, rowHeight));
            }
            for (int i = 0; i < column; i++)
            {
                ColumnStyles.Add(new ColumnStyle(SizeType.Percent, columnWidth));
            }

            // 添加播放器
            for (int r = 0; r < RowCount; r++)
            {
                for (int c = 0; c < ColumnCount; c++)
                {
                    FormRealPlayer player = new FormRealPlayer(mgr);
                    player.Dock            = DockStyle.Fill;
                    player.FormBorderStyle = FormBorderStyle.None;
                    player.TopLevel        = false;
                    this.Controls.Add(player, c, r);
                    player.setGrid(this, c, r);
                    player.Show();
                }
            }
        }
Example #2
0
        /// <summary>
        /// 新窗体播放视频
        /// </summary>
        /// <param name="nvr"></param>
        /// <param name="channel"></param>

        public void realPlayInForm(int nvr, int channel)
        {
            if (realPlayerForms.Count >= MAX_POP)
            {
                return;
            }

            FormMain.mainForm.BeginInvoke((Action) delegate
            {
                FormRealPlayer player = new FormRealPlayer(this);

                player.TopMost = true;
                realPlayerForms.Add(player);

                player.isPlaying   = true;
                player.realSession = nvrAdapterMgr.realPlay(nvr, channel, player.playerHandle);

                if (player.realSession >= 0)
                {
                    //播放成功
                    player.isPlaying = true;
                    player.setVideoId(nvr, channel);
                }
                else
                {
                    player.isPlaying = false;
                }

                player.Show();
            });
        }