private void Form2_Load(object sender, EventArgs e)
        {
            _currentDevice = this.Name as string;

            CustomControl.RoundPanel _panel = new CustomControl.RoundPanel();
            _panel.Height      = this.splitContainer1.Panel1.Height - 20;
            _panel.Width       = this.splitContainer1.Panel1.Width - 10;
            _panel.Location    = new Point(10, 10);
            _panel.RoundeStyle = RoundStyle.All;
            _panel.Radius      = 30;
            _panel.BorderColor = Color.Black;

            pictureBoxSame = new PictureBox();
            pictureBoxSame.BackgroundImageLayout = ImageLayout.Stretch;
            pictureBoxSame.SizeMode   = PictureBoxSizeMode.StretchImage;
            pictureBoxSame.MouseDown += PictureBox1_MouseDown;
            pictureBoxSame.MouseMove += PictureBox1_MouseMove;
            pictureBoxSame.MouseUp   += PictureBox1_MouseUp;
            pictureBoxSame.Height     = _panel.Height - 70;
            pictureBoxSame.Width      = _panel.Width - 20;
            pictureBoxSame.Location   = new Point(10, 30);

            FlowLayoutPanel fp = new FlowLayoutPanel();

            fp.Height   = 30;
            fp.Width    = pictureBoxSame.Width;
            fp.Location = new Point(10, pictureBoxSame.Height + pictureBoxSame.Location.Y + 5);
            fp.Parent   = _panel;

            var currentWidth = (fp.Width - 20) * 13 / 84;

            SetBottomBtn(fp, currentWidth, returnBottomBtnEvent());

            this.splitContainer1.Panel1.Controls.Add(_panel);
            _panel.Controls.Add(pictureBoxSame);
            _panel.Controls.Add(fp);

            this.ActiveControl = pictureBoxSame;

            this.StartPosition = FormStartPosition.CenterParent;

            //初始化分辨率
            wmPointModel = baseAction.GetWMSize(_currentDevice);

            this.pictureBoxSame.Name = string.Format(string.Format("Big_{0}", partialControlName), _currentDevice);

            this.pictureBoxSame.Tag = string.Format(partialControlName, _currentDevice);

            this.pictureBoxSame.BackColor = Color.Black;

            this.pictureBoxSame.Image = this.Tag as Image;

            baseAction.CurrentSameScreenControl = this.pictureBoxSame;

            var allCheckBox = new CheckBox()
            {
                Text = "全选",

                Name = "allCheck",

                ForeColor = Color.DarkTurquoise,

                TextAlign = ContentAlignment.MiddleLeft
            };

            allCheckBox.CheckedChanged += (er, obj) =>
            {
                var checkBox = er as CheckBox;

                CheckAllAndUpdateUI(this.flowLayoutPanelWithEquipment, checkBox);
            };



            this.flowLayoutPanelWithEquipment.Controls.Add(allCheckBox);

            CheckSomeEquipmentToDO(this.flowLayoutPanelWithEquipment, new DeviceToNickNameViewModel()
            {
                Device = _currentDevice
            });

            InitGroup(this.panelWithSameScreenGroup);
        }
示例#2
0
        private Control CreateEquipmentMapToPC(DeviceToNickNameViewModel model, MouseEventHandler handler)
        {
            CustomControl.RoundPanel _panel = new CustomControl.RoundPanel();

            _panel.Width       = _width;
            _panel.Height      = _height;
            _panel.Margin      = new Padding(10, 20, 10, 20);
            _panel.RoundeStyle = RoundStyle.All;
            _panel.Radius      = 30;
            _panel.Tag         = model.NickName;
            _panel.BorderColor = Color.Black;
            _panel.Name        = string.Format(partialControlName, model.Device);

            var _btn = CreateActionBtn(_panel, model.NickName, _panel.Width - _marginH * 2);

            _btn.Name     = model.Device;
            _btn.Location = new Point(_marginH, _marginV);
            _btn.Click   += (o, s) =>
            {
                var currentBtn = (Button)o;

                OpenSetEquipmentFrom(currentBtn);
            };

            var _checkBox = new CheckBox();

            _checkBox.Location           = new Point(_panel.Width - 15, _marginV);
            _checkBox.Width              = 30;
            _checkBox.Tag                = model.Device;
            _checkBox.Text               = "_";
            _checkBox.CheckStateChanged += (s, o) =>
            {
                var currentCheckBox = s as CheckBox;

                var currentDevice = currentCheckBox.Tag as string;

                if (currentCheckBox.Checked)
                {
                    currentCheckBox.ForeColor = Color.OrangeRed;

                    baseAction.CheckSomeEquipments.Value.Add(currentDevice, currentCheckBox);
                }
                else
                {
                    currentCheckBox.ForeColor = Color.DarkGray;

                    baseAction.CheckSomeEquipments.Value.Remove(currentDevice);
                }

                // currentCheckBox.Checked = !currentCheckBox.Checked;
            };

            PictureBox _picBox = new PictureBox();

            _picBox.BackgroundImageLayout = ImageLayout.Stretch;
            _picBox.SizeMode          = PictureBoxSizeMode.StretchImage;
            _picBox.MouseDoubleClick += handler;
            _picBox.BackColor         = Color.Black;
            _picBox.Width             = _panel.Width - _marginH * 2;
            _picBox.Height            = _panel.Height - 95;
            _picBox.Location          = new Point(_marginH, _btn.Height + _btn.Location.Y);

            FlowLayoutPanel fp = new FlowLayoutPanel();

            fp.Height   = 30;
            fp.Width    = _panel.Width - _marginH * 2;
            fp.Location = new Point(_marginH, _picBox.Height + _picBox.Location.Y);
            fp.Parent   = _panel;
            SingleEquipmentAction(fp);
            fp.Name = string.Format("{0}_{1}", model.NickName, model.Device);

            _panel.Controls.Add(_picBox);

            _panel.Controls.Add(fp);

            //_panel.Controls.Add(_checkBox);

            baseAction.SetContentWithCurrentThread <Control>(this.flowLayoutPanel3, _panel, (parent, panel) =>
            {
                if (string.IsNullOrEmpty(GetPictureByName(parent, panel.Name).Name))
                {
                    parent.Controls.Add(panel);
                }
            });


            if (!baseAction.Dic.Value.Keys.Contains(model.Device))
            {
                baseAction.Dic.Value.Add(model.Device, _panel);
            }


            return(_panel);
        }