• 大小: 59KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-14
  • 语言: C#
  • 标签: 多分屏  

资源简介

基于TableLayoutPanel的多分屏、全屏程序源代码(C#),仅仅提供动态多分屏、单击全屏方法和相关演示,还未添加播放模块! 详见: http://blog.csdn.net/u011127242/article/details/55668875

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows;

namespace MultiCamera
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender EventArgs e)
        {
            split_screen(1);
            //记录原来屏幕大小和宽高
            Point_Old = new System.Drawing.Point(this.Location.Xthis.Location.Y); 
            Width_Old = this.Width;
            Height_old = this.Height;
        }
        private int curScreenNum = 0;
        private bool isFullScreen = false;
        private int row = 0;
        private int col = 0;
        private PictureBox[] pb = new PictureBox[25];
        private Point Point_Old = new System.Drawing.Point();
        private int Width_Old;
        private int Height_old;
        private void split_screen(int num)
        {
            tlp_screen.Columnstyles.Clear();
            tlp_screen.Rowstyles.Clear(); //清除行列属性
            int i;
            for (i = 0; i < curScreenNum; i++)
            {
                tlp_screen.Controls.Remove(pb[i]);
            }
            tlp_screen.Refresh();
            int Sqrt_num = (int)Math.Sqrt(num);
            tlp_screen.ColumnCount = Sqrt_num;
            tlp_screen.RowCount = Sqrt_num;
            int pb_width = (tlp_screen.Width-6*Sqrt_num) / Sqrt_num; //无法修改picturebox的Margin为0(默认为3),所以需要空格6*列/行
            int pb_height = (tlp_screen.Height-6*Sqrt_num) / Sqrt_num;
            for (i = 0; i < num; i++)
            {
                row = i / Sqrt_num;
                col = i % Sqrt_num;
                pb[i] = new PictureBox();
                pb[i].Tag = i;
                pb[i].Click += new System.EventHandler(this.PicClick);
                //pb[i].Padding = new Padding(1 1 1 1); //为何不管用
                tlp_screen.Controls.Add(pb[i]colrow);
                pb[i].BackColor = Color.FromArgb(50 20 * (row + col) 40 * row 10 * col);
                pb[i].Location = new System.Drawing.Point(row * pb_width col * pb_height);
                pb[i].Size = new System.Drawing.Size(pb_widthpb_height);
                //Console.WriteLine(“pb[{0}] w:{1} h:{2} x:{3}y:{4}“ ipb[i].Width pb[i].Height pb[i].Location.X pb[i].Location.Y);
            }
            curScreenNum = num;
        }

        private void PicClick(object sender EventArgs e)
        {
            PictureBox pic = sender as PictureBox;
            pic.BackColor = Color.Blue ;
            string PicTag = pic.Tag.ToString();
            //MessageBox.Show(“I‘m PictrueBox[“+PicTag+“]“);
            FullScreen(pic);
            switch (PicTag)
            {
                case “0“:
                    break;
                case “1“:
              

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-01-14 16:34  MultiCamera\
     目录           0  2017-01-14 16:34  MultiCamera\MultiCamera\
     文件         923  2017-01-14 16:34  MultiCamera\MultiCamera.sln
     文件       28160  2017-02-11 14:05  MultiCamera\MultiCamera.v11.suo
     文件         187  2017-01-14 16:34  MultiCamera\MultiCamera\App.config
     目录           0  2017-01-14 16:34  MultiCamera\MultiCamera\bin\
     目录           0  2017-02-11 11:39  MultiCamera\MultiCamera\bin\Debug\
     文件       12800  2017-02-11 14:56  MultiCamera\MultiCamera\bin\Debug\MultiCamera.exe
     文件         187  2017-01-14 16:34  MultiCamera\MultiCamera\bin\Debug\MultiCamera.exe.config
     文件       28160  2017-02-11 14:56  MultiCamera\MultiCamera\bin\Debug\MultiCamera.pdb
     文件       22984  2017-02-11 14:56  MultiCamera\MultiCamera\bin\Debug\MultiCamera.vshost.exe
     文件         187  2017-01-14 16:34  MultiCamera\MultiCamera\bin\Debug\MultiCamera.vshost.exe.config
     文件         490  2014-01-13 21:31  MultiCamera\MultiCamera\bin\Debug\MultiCamera.vshost.exe.manifest
     文件        6921  2017-02-11 14:56  MultiCamera\MultiCamera\Form1.cs
     文件        6313  2017-02-11 14:21  MultiCamera\MultiCamera\Form1.Designer.cs
     文件        5817  2017-02-11 14:21  MultiCamera\MultiCamera\Form1.resx
     文件        3801  2017-01-14 16:37  MultiCamera\MultiCamera\MultiCamera.csproj
     目录           0  2017-01-14 16:34  MultiCamera\MultiCamera\obj\
     目录           0  2017-02-11 14:56  MultiCamera\MultiCamera\obj\Debug\
     文件        1308  2017-01-21 15:39  MultiCamera\MultiCamera\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6987  2017-01-14 16:34  MultiCamera\MultiCamera\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         762  2017-02-11 14:56  MultiCamera\MultiCamera\obj\Debug\MultiCamera.csproj.FileListAbsolute.txt
     文件         975  2017-02-11 14:21  MultiCamera\MultiCamera\obj\Debug\MultiCamera.csproj.GenerateResource.Cache
     文件        2209  2017-02-11 13:03  MultiCamera\MultiCamera\obj\Debug\MultiCamera.csprojResolveAssemblyReference.cache
     文件       12800  2017-02-11 14:56  MultiCamera\MultiCamera\obj\Debug\MultiCamera.exe
     文件         180  2017-02-11 14:21  MultiCamera\MultiCamera\obj\Debug\MultiCamera.Form1.resources
     文件       28160  2017-02-11 14:56  MultiCamera\MultiCamera\obj\Debug\MultiCamera.pdb
     文件         180  2017-02-11 11:39  MultiCamera\MultiCamera\obj\Debug\MultiCamera.Properties.Resources.resources
     文件           0  2017-01-14 16:34  MultiCamera\MultiCamera\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
     文件           0  2017-01-14 16:34  MultiCamera\MultiCamera\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
     文件           0  2017-01-14 16:34  MultiCamera\MultiCamera\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
............此处省略8个文件信息

评论

共有 条评论

相关资源