コード例 #1
0
ファイル: AddFloorPlan.cs プロジェクト: zmaples/iSpy
        private void BtnChooseFileClick(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog
            {
                InitialDirectory = Program.AppPath + @"backgrounds\",
                Filter           = "Image Files|*.jpg;*.gif;*.bmp;*.png;*.jpeg",
                FilterIndex      = 1
            };

            if (ofd.ShowDialog(this) == DialogResult.OK)
            {
                string fileName = ofd.FileName;
                Fpc.Fpobject.image = fileName;
                Image img = Image.FromFile(fileName);
                try
                {
                    Fpc.ImgPlan = (Bitmap)img.Clone(); //
                    var rf = new ResizeBilinear(533, 400);
                    _floorPlanImage = rf.Apply((Bitmap)img);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                Fpc.NeedSizeUpdate = true;
                Fpc.NeedsRefresh   = true;
                if (txtName.Text.Trim() == "")
                {
                    txtName.Text = "Plan " + MainForm.NextFloorPlanId;
                }
                _pnlPlan.Invalidate();
            }
            ofd.Dispose();
        }
コード例 #2
0
ファイル: AddFloorPlan.cs プロジェクト: zmaples/iSpy
        private void AddFloorPlanLoad(object sender, EventArgs e)
        {
            txtName.Text = Fpc.Fpobject.name;

            if (Fpc.Fpobject.image != "")
            {
                try
                {
                    _floorPlanImage = (Bitmap)Image.FromFile(Fpc.Fpobject.image);
                }
                catch (Exception ex)
                {
                    Logger.LogExceptionToFile(ex);
                }
            }

            lbObjects.AllowDrop = true;
            _pnlPlan            = new Controls.PictureBox {
                Location = new Point(64, 0), Size = new Size(533, 400), AllowDrop = true
            };
            pnlFloorPlan.Controls.Add(_pnlPlan);

            _floorPlanEntries = new List <objectsFloorplanObjectsEntry>();

            foreach (objectsFloorplanObjectsEntry fpobj in Fpc.Fpobject.objects.@object)
            {
                _floorPlanEntries.Add(fpobj);
            }

            ShowObjects();

            _pnlPlan.DragDrop  += PnlPlanDragDrop;
            _pnlPlan.DragEnter += PnlPlanDragEnter;
            _pnlPlan.DragOver  += PnlPlanDragOver;
            _pnlPlan.MouseDown += PMouseDown;
            _pnlPlan.MouseUp   += PMouseUp;
            _pnlPlan.MouseMove += PMouseMove;
            _pnlPlan.Paint     += PnlPlanPaint;

            chkOriginalSize.Checked = Fpc.Fpobject.originalsize;
            txtAccessGroups.Text    = Fpc.Fpobject.accessgroups;

            _pnlPlan.Invalidate();
            if (Fpc.Fpobject.id > -1)
            {
                Text = LocRm.GetString("EditFloorPlan");
            }
        }
コード例 #3
0
        // Update filter
        private void UpdateFilter()
        {
            _filter.Hue        = _hue;
            _filter.Saturation = _saturation;
            _filter.Luminance  = _luminance;

            lock (SyncLock)
            {
                if (ImageProcess != null)
                {
                    _filterPreview.Image?.Dispose();

                    _filterPreview.Image = _filter.Apply(ImageProcess);
                    _filterPreview.Invalidate();
                }
            }
        }
コード例 #4
0
ファイル: AddFloorPlan.cs プロジェクト: rickyHong/IPCameraCtl
        private void AddFloorPlanLoad(object sender, EventArgs e)
        {
            txtName.Text = Fpc.Fpobject.name;

            if (Fpc.Fpobject.image != "")
            {
                try
                {
                    _floorPlanImage = (Bitmap)Image.FromFile(Fpc.Fpobject.image);
                }
                catch (Exception ex)
                {
                    MainForm.LogExceptionToFile(ex);
                }
            }

            lbObjects.AllowDrop = true;
            _pnlPlan = new Controls.PictureBox {Location = new Point(64, 0), Size = new Size(533, 400), AllowDrop = true};
            pnlFloorPlan.Controls.Add(_pnlPlan);

            _floorPlanEntries = new List<objectsFloorplanObjectsEntry>();

            foreach (objectsFloorplanObjectsEntry fpobj in Fpc.Fpobject.objects.@object)
            {
                _floorPlanEntries.Add(fpobj);
            }

            ShowObjects();

            _pnlPlan.DragDrop += PnlPlanDragDrop;
            _pnlPlan.DragEnter += PnlPlanDragEnter;
            _pnlPlan.DragOver += PnlPlanDragOver;
            _pnlPlan.MouseDown += PMouseDown;
            _pnlPlan.MouseUp += PMouseUp;
            _pnlPlan.MouseMove += PMouseMove;
            _pnlPlan.Paint += PnlPlanPaint;

            chkOriginalSize.Checked = Fpc.Fpobject.originalsize;
            txtAccessGroups.Text = Fpc.Fpobject.accessgroups;

            _pnlPlan.Invalidate();
            if (Fpc.Fpobject.id > -1)
                Text = LocRm.GetString("EditFloorPlan");
        }