手上要做一个视屏监控界面控制,功能要求:标准九宫格,视屏切换,拖拽切换使用tableLayoutPanel,用户控件CameraDrive(该控件上动态加载相关的视屏监控控件)在tableLayoutPanel上动态加载CameraDrive问题来了,如何把当前的操作传递给CameraDrive而不是CameraDrive上覆盖的控件?例:点击事件
当鼠标点击tableLayoutPanel上的单元格中的CameraDrive,获取点击的是CameraDrive上覆盖的控件(该覆盖的控件无点击事件),如何让CameraDrive获取该点击事件

解决方案 »

  1.   

    响应tableLayoutPanel的Click事件,之后根据点击时的鼠标坐标判断处于屏幕九宫格的哪一格,然后再分类处理,不知道这样行不?
      

  2.   

    视频监控分层可使用
    public Rectangle[] GetSplittedRectangles(Rectangle rt, int rowCount,int colCount)
            {
                Rectangle[] rects = new Rectangle[rowCount * colCount];            int width = rt.Width / colCount;
                int height = rt.Height / rowCount;            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
                {
                    for (int colIndex = 0; colIndex < colCount; colIndex++)
                    {
                        rects[rowIndex * colCount + colIndex] = new Rectangle(colIndex * width,
                            rowIndex * height, width, height);
                    }
                }            return rects;
            }
      

  3.   

    因为有掩盖的CameraDrive上有覆盖的控件 无法获取tablelayoutPanel的Click事件