Inheritance: AForge.Controls.PictureBox
コード例 #1
0
ファイル: LayoutPanel.cs プロジェクト: zmaples/iSpy
        public void ResetLayout()
        {
            foreach (LayoutItem li in SavedLayout)
            {
                switch (li.ObjectTypeId)
                {
                case 1:
                    VolumeLevel vl = MainForm.InstanceReference.GetVolumeLevel(li.ObjectId);
                    if (vl != null)
                    {
                        vl.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        vl.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;

                case 2:
                    CameraWindow cw = MainForm.InstanceReference.GetCameraWindow(li.ObjectId);
                    if (cw != null)
                    {
                        cw.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        cw.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;

                case 3:
                    FloorPlanControl fp = MainForm.InstanceReference.GetFloorPlan(li.ObjectId);
                    if (fp != null)
                    {
                        fp.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        fp.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;
                }
            }
        }
コード例 #2
0
 private void SetFloorPlanEvents(FloorPlanControl fpc)
 {
     fpc.DoubleClick += FloorPlanDoubleClick;
     fpc.MouseDown += FloorPlanMouseDown;
     fpc.MouseUp += FloorPlanMouseUp;
     fpc.MouseMove += FloorPlanMouseMove;
 }
コード例 #3
0
        private void RemoveFloorplan(FloorPlanControl fpc, bool confirm)
        {
            if (confirm &&
                MessageBox.Show(LocRm.GetString("AreYouSure"), LocRm.GetString("Confirm"), MessageBoxButtons.OKCancel,
                                MessageBoxIcon.Warning) == DialogResult.Cancel)
                return;

            if (fpc.Fpobject?.objects?.@object != null)
            {
                foreach (var o in fpc.Fpobject.objects.@object)
                {
                    switch (o.type)
                    {
                        case "camera":
                            CameraWindow cw = GetCameraWindow(o.id);
                            if (cw != null)
                            {
                                //cw.Location = new Point(Location.X + e.X, Location.Y + e.Y);
                                cw.Highlighted = false;
                                cw.Invalidate();
                            }
                            break;
                        case "microphone":
                            VolumeLevel vl = GetVolumeLevel(o.id);
                            if (vl != null)
                            {
                                vl.Highlighted = false;
                                vl.Invalidate();
                            }
                            break;
                    }
                }
            }
            _pnlCameras.Controls.Remove(fpc);

            if (!_closing)
            {
                objectsFloorplan ofp = FloorPlans.SingleOrDefault(p => p.id == fpc.Fpobject.id);
                if (ofp != null)
                    FloorPlans.Remove(ofp);
                SetNewStartPosition();
                NeedsSync = true;
            }
            fpc.Dispose();
        }
コード例 #4
0
        private void AddFloorPlan()
        {
            var ofp = new objectsFloorplan
            {
                objects = new objectsFloorplanObjects { @object = new objectsFloorplanObjectsEntry[0] },
                id = -1,
                image = "",
                height = 480,
                width = 640,
                x = Convert.ToInt32(Random.NextDouble() * 100),
                y = Convert.ToInt32(Random.NextDouble() * 100),
                name = LocRm.GetString("FloorPlan") + " " + NextFloorPlanId
            };

            var fpc = new FloorPlanControl(ofp, this) { BackColor = Conf.BackColor.ToColor() };
            _pnlCameras.Controls.Add(fpc);

            fpc.Location = new Point(ofp.x, ofp.y);
            fpc.Size = new Size(320, 240);
            fpc.BringToFront();
            fpc.Tag = GetControlIndex();

            var afp = new AddFloorPlan { Fpc = fpc, Owner = this, MainClass = this };
            afp.ShowDialog(this);
            if (afp.DialogResult == DialogResult.OK)
            {
                UnlockLayout();
                afp.Fpc.Fpobject.id = NextFloorPlanId;
                FloorPlans.Add(ofp);
                SetFloorPlanEvents(fpc);
                SetNewStartPosition();
                fpc.Invalidate();
            }
            else
            {
                _pnlCameras.Controls.Remove(fpc);
                fpc.Dispose();
            }
            afp.Dispose();
        }
コード例 #5
0
 internal void DisplayFloorPlan(objectsFloorplan ofp)
 {
     var fpControl = new FloorPlanControl(ofp, this);
     SetFloorPlanEvents(fpControl);
     fpControl.BackColor = Conf.BackColor.ToColor();
     _pnlCameras.Controls.Add(fpControl);
     fpControl.Location = new Point(ofp.x, ofp.y);
     fpControl.Size = new Size(ofp.width, ofp.height);
     fpControl.BringToFront();
     fpControl.Tag = GetControlIndex();
 }
コード例 #6
0
ファイル: MainForm_Configuration.cs プロジェクト: vmail/main
        private void RemoveFloorplan(FloorPlanControl fpc, bool confirm)
        {
            if (confirm &&
                MessageBox.Show(LocRm.GetString("AreYouSure"), LocRm.GetString("Confirm"), MessageBoxButtons.OKCancel,
                                MessageBoxIcon.Warning) == DialogResult.Cancel)
                return;
            _pnlCameras.Controls.Remove(fpc);

            if (!_closing)
            {
                objectsFloorplan ofp = FloorPlans.SingleOrDefault(p => p.id == fpc.Fpobject.id);
                if (ofp != null)
                    FloorPlans.Remove(ofp);
                SetNewStartPosition();
                NeedsSync = true;
            }
            fpc.Dispose();
        }