Beispiel #1
0
        void OnUpdateDisplayPostion()
        {
            uint row = 0, col = 0;

            _FormControl.GetDataControl().GetDisplayWndNum(ref row, ref col);

            uint w = (uint)this.Width;
            uint h = (uint)this.Height;

            //先计算显示窗口的位置和大小,依据为:在不超过主窗口大小的情况下尽可能大,同时严格保持4:3的比例显示
            uint real_width  = w - CONTROLWINDOW_WIDTH;
            uint real_height = h;

            uint display_width  = (real_width - DISPLAYWND_MARGIN * 2 - (col - 1) * DISPLAYWND_GAP) / col;  //单个相机显示区域的宽度(还未考虑比例)
            uint display_height = (real_height - DISPLAYWND_MARGIN * 2 - (row - 1) * DISPLAYWND_GAP) / row; //单个相机显示区域的高度(还未考虑比例)

            if (display_width * 3 >= display_height * 4)                                                    //考虑比例
            {
                uint ret = display_height % 3;
                if (ret != 0)
                {
                    display_height -= ret;
                }
                display_width = display_height * 4 / 3;
            }
            else
            {
                uint ret = display_width % 4;
                if (ret != 0)
                {
                    display_width -= ret;
                }
                display_height = display_width * 3 / 4;
            }

            for (uint i = 0; i < row; i++)
            {
                uint y = DISPLAYWND_MARGIN + (display_height + DISPLAYWND_GAP) * i;

                for (uint j = 0; j < col; j++)
                {
                    uint x = DISPLAYWND_MARGIN + (display_width + DISPLAYWND_GAP) * j;

                    FormDisplay frm = _FormDisplayLst[i * col + j];
                    frm.Left   = (int)x;
                    frm.Top    = (int)y;
                    frm.Width  = (int)display_width;
                    frm.Height = (int)display_height;
                }
            }

            //计算显示窗口的背景窗口的位置和大小
            uint display_bg_width  = DISPLAYWND_MARGIN * 2 + display_width * col + DISPLAYWND_GAP * (col - 1);
            uint display_bg_height = DISPLAYWND_MARGIN * 2 + display_height * row + DISPLAYWND_GAP * (row - 1);

            _FormDisplayBG.Left   = 0;
            _FormDisplayBG.Top    = 0;
            _FormDisplayBG.Width  = (int)display_bg_width;
            _FormDisplayBG.Height = (int)display_bg_height;
            _FormDisplayBG.Show();

            //更新显示窗口的显示与隐藏
            uint num = row * col;

            for (uint i = 0; i < num; i++)
            {
                _FormDisplayLst[i].Show();
            }

            for (uint i = num; i < MAX_DEVWINDOW_NUM; i++)
            {
                _FormDisplayLst[i].Hide();
            }
        }
Beispiel #2
0
        void OnUpdateDisplayPostion()
        {
            uint row = 0, col = 0;

            _FormControl.GetDataControl().GetDisplayWndNum(ref row, ref col);

            uint w = (uint)this.Width;
            uint h = (uint)this.Height;

            //先计算显示窗口的位置和大小,依据为:在不超过主窗口大小的情况下尽可能大,同时严格保持4:3的比例显示
            uint real_width  = w - CONTROLWINDOW_WIDTH;
            uint real_height = h;

            uint display_width  = (real_width - DISPLAYWND_MARGIN * 2 - (col - 1) * DISPLAYWND_GAP) / col;  //单个相机显示区域的宽度(还未考虑比例)
            uint display_height = (real_height - DISPLAYWND_MARGIN * 2 - (row - 1) * DISPLAYWND_GAP) / row; //单个相机显示区域的高度(还未考虑比例)

            if (display_width * 3 >= display_height * 4)                                                    //考虑比例
            {
                uint ret = display_height % 3;
                if (ret != 0)
                {
                    display_height -= ret;
                }
                display_width = display_height * 4 / 3;
            }
            else
            {
                uint ret = display_width % 4;
                if (ret != 0)
                {
                    display_width -= ret;
                }
                display_height = display_width * 3 / 4;
            }

            for (uint i = 0; i < row; i++)
            {
                uint y = DISPLAYWND_MARGIN + (display_height + DISPLAYWND_GAP) * i;

                for (uint j = 0; j < col; j++)
                {
                    uint x = DISPLAYWND_MARGIN + (display_width + DISPLAYWND_GAP) * j;

                    FormDisplay frm = _FormDisplayLst[i * col + j];
                    frm.Left   = (int)x;
                    frm.Top    = (int)y;
                    frm.Width  = (int)display_width;
                    frm.Height = (int)display_height;
                    frm.Name   = "视频" + (j + 1);
                }
            }

            //计算显示窗口的背景窗口的位置和大小
            uint display_bg_width  = DISPLAYWND_MARGIN * 2 + display_width * col + DISPLAYWND_GAP * (col - 1);
            uint display_bg_height = DISPLAYWND_MARGIN * 2 + display_height * row + DISPLAYWND_GAP * (row - 1);

            _FormDisplayBG.Left      = 0;
            _FormDisplayBG.Top       = 0;
            _FormDisplayBG.Width     = (int)display_bg_width;
            _FormDisplayBG.Height    = (int)display_bg_height;
            _FormDisplayBG.BackColor = Color.Red;
            _FormDisplayBG.Show();

            int count = rw.IniReadValue("ListCout", "Count").CastTo <int>(-1);

            FormDateSet.getNewZGInfo += GetZGinfoToDisplay;

            //更新显示窗口的显示与隐藏
            uint num = row * col;

            for (uint i = 0; i < num; i++)
            {
                _FormDisplayLst[i].Show();
            }

            for (uint i = num; i < MAX_DEVWINDOW_NUM; i++)
            {
                _FormDisplayLst[i].Hide();
            }
            if (!CheckCanshuOkbuOk(count))
            {
                GetOPCTaskInfo("未找到任何甑锅的参数,请录入甑锅参数后重启程序");
                MessageBox.Show("未找到任何甑锅的参数,请录入甑锅参数!", "参数文件未找到!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                fds.ShowDialog();
            }
        }