Пример #1
0
        private void PostInitializeComponent()
        {
            imageList.UserConfigManager      = UserConfigManager;
            thumbnailList1.UserConfigManager = UserConfigManager;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;

            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);

            RelayoutToolbar();
            InitLanguageDropdown();
            UpdateScanButton();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location  = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            layoutManager       = new LayoutManager(this)
                                  .Bind(btnZoomIn, btnZoomOut)
                                  .BottomToForm()
                                  .Activate();
        }
Пример #2
0
        protected override void OnLoad(object sender, EventArgs e)
        {
            lvProfiles.LargeImageList = ilProfileIcons.IconsList;
            btnAdd.Enabled            = !(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
            btnEdit.Enabled           = false;
            btnDelete.Enabled         = false;
            UpdateProfiles();
            SelectProfile(x => x.IsDefault);

            if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
            {
                contextMenuStrip.Items.Remove(ctxCopy);
                contextMenuStrip.Items.Remove(ctxPaste);
                contextMenuStrip.Items.Remove(toolStripSeparator2);
            }

            var lm = new LayoutManager(this)
                     .Bind(lvProfiles)
                     .WidthToForm()
                     .HeightToForm()
                     .Bind(btnAdd, btnEdit, btnDelete, btnDone)
                     .BottomToForm()
                     .Bind(btnDone, btnScan)
                     .RightToForm()
                     .Bind(btnEdit)
                     .LeftTo(() => btnAdd.Right)
                     .Bind(btnDelete)
                     .LeftTo(() => btnEdit.Right)
                     .Activate();

            iconButtonSizer.WidthOffset  = 20;
            iconButtonSizer.PaddingRight = 4;
            iconButtonSizer.MaxWidth     = 100;
            iconButtonSizer.ResizeButtons(btnAdd, btnEdit, btnDelete);

            lm.UpdateLayout();
        }
Пример #3
0
        protected override void OnLoad(object sender, EventArgs eventArgs)
        {
            if (SelectedImages != null && SelectedImages.Count > 1)
            {
                checkboxApplyToSelected.Text = string.Format(checkboxApplyToSelected.Text, SelectedImages.Count);
            }
            else
            {
                ConditionalControls.Hide(checkboxApplyToSelected, 6);
            }

            var lm = new LayoutManager(this)
                     .Bind(pictureBox)
                     .WidthToForm()
                     .HeightToForm()
                     .Bind(tbLeft, tbRight)
                     .WidthTo(() => (int)(GetImageWidthRatio() * pictureBox.Width))
                     .LeftTo(() => (int)((1 - GetImageWidthRatio()) * pictureBox.Width / 2))
                     .Bind(tbTop, tbBottom)
                     .HeightTo(() => (int)(GetImageHeightRatio() * pictureBox.Height))
                     .TopTo(() => (int)((1 - GetImageHeightRatio()) * pictureBox.Height / 2))
                     .Bind(tbBottom, btnOK, btnCancel)
                     .RightToForm()
                     .Bind(tbRight, checkboxApplyToSelected, btnRevert, btnOK, btnCancel)
                     .BottomToForm()
                     .Activate();

            Size = new Size(600, 600);

            workingImage  = scannedImageRenderer.Render(Image);
            workingImage2 = scannedImageRenderer.Render(Image);
            UpdateCropBounds();
            UpdatePreviewBox();

            lm.UpdateLayout();
        }
Пример #4
0
        /// <summary>
        /// Runs when the form is first loaded and every time the language is changed.
        /// </summary>
        private void PostInitializeComponent()
        {
            imageList.UserConfigManager = UserConfigManager;
            thumbnailList1.UserConfigManager = UserConfigManager;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);

            RelayoutToolbar();
            InitLanguageDropdown();
            UpdateScanButton();
            LoadToolStripLocation();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            btnZoomMouseCatcher.Location = new Point(btnZoomMouseCatcher.Location.X, thumbnailList1.Height - 33);
            layoutManager = new LayoutManager(this)
                   .Bind(btnZoomIn, btnZoomOut, btnZoomMouseCatcher)
                       .BottomTo(() => thumbnailList1.Height)
                   .Activate();

            thumbnailList1.MouseWheel += thumbnailList1_MouseWheel;
            thumbnailList1.SizeChanged += (sender, args) => layoutManager.UpdateLayout();
        }
Пример #5
0
        protected override void OnLoad(object sender, EventArgs e)
        {
            lvProfiles.LargeImageList = ilProfileIcons.IconsList;
            btnEdit.Enabled = false;
            btnDelete.Enabled = false;
            UpdateProfiles();
            SelectProfile(x => x.IsDefault);

            var lm = new LayoutManager(this)
                .Bind(lvProfiles)
                    .WidthToForm()
                    .HeightToForm()
                .Bind(btnAdd, btnEdit, btnDelete, btnDone)
                    .BottomToForm()
                .Bind(btnDone, btnScan)
                    .RightToForm()
                .Bind(btnEdit)
                    .LeftTo(() => btnAdd.Right)
                .Bind(btnDelete)
                    .LeftTo(() => btnEdit.Right)
                .Activate();

            iconButtonSizer.WidthOffset = 20;
            iconButtonSizer.PaddingRight = 4;
            iconButtonSizer.MaxWidth = 100;
            iconButtonSizer.ResizeButtons(btnAdd, btnEdit, btnDelete);

            lm.UpdateLayout();
        }
Пример #6
0
 public BindingSyntax(LayoutManager layoutManager, Control[] controls)
 {
     this.layoutManager = layoutManager;
     this.controls      = controls;
 }
Пример #7
0
        private void PostInitializeComponent()
        {
            imageList.UserConfigManager = UserConfigManager;
            thumbnailList1.UserConfigManager = UserConfigManager;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);

            RelayoutToolbar();
            InitLanguageDropdown();
            UpdateScanButton();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            layoutManager = new LayoutManager(this)
                   .Bind(btnZoomIn, btnZoomOut)
                       .BottomToForm()
                   .Activate();
        }
Пример #8
0
        protected override void OnLoad(object sender, EventArgs eventArgs)
        {
            if (SelectedImages != null && SelectedImages.Count > 1)
            {
                checkboxApplyToSelected.Text = string.Format(checkboxApplyToSelected.Text, SelectedImages.Count);
            }
            else
            {
                ConditionalControls.Hide(checkboxApplyToSelected, 6);
            }

            var lm = new LayoutManager(this)
                .Bind(pictureBox)
                    .WidthToForm()
                    .HeightToForm()
                .Bind(tbLeft, tbRight)
                    .WidthTo(() => (int)(GetImageWidthRatio() * pictureBox.Width))
                    .LeftTo(() => (int)((1 - GetImageWidthRatio()) * pictureBox.Width / 2))
                .Bind(tbTop, tbBottom)
                    .HeightTo(() => (int)(GetImageHeightRatio() * pictureBox.Height))
                    .TopTo(() => (int)((1 - GetImageHeightRatio()) * pictureBox.Height / 2))
                .Bind(tbBottom, btnOK, btnCancel)
                    .RightToForm()
                .Bind(tbRight, checkboxApplyToSelected, btnRevert, btnOK, btnCancel)
                    .BottomToForm()
                .Activate();
            Size = new Size(600, 600);

            workingImage = Image.GetImage();
            workingImage2 = Image.GetImage();
            UpdateCropBounds();
            UpdatePreviewBox();

            lm.UpdateLayout();
        }
Пример #9
0
 public BindingSyntax(LayoutManager layoutManager, Control[] controls)
 {
     this.layoutManager = layoutManager;
     this.controls = controls;
 }
Пример #10
0
        /// <summary>
        /// Runs when the form is first loaded and every time the language is changed.
        /// </summary>
        private void PostInitializeComponent()
        {
            imageList.ThumbnailRenderer = thumbnailRenderer;
            thumbnailList1.ThumbnailRenderer = thumbnailRenderer;
            int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
            thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);
            SetThumbnailSpacing(thumbnailSize);

            if (appConfigManager.Config.HideEmailButton)
            {
                tStrip.Items.Remove(tsdEmailPDF);
            }
            if (appConfigManager.Config.HidePrintButton)
            {
                tStrip.Items.Remove(tsPrint);
            }

            LoadToolStripLocation();
            RelayoutToolbar();
            InitLanguageDropdown();
            AssignKeyboardShortcuts();
            UpdateScanButton();

            if (layoutManager != null)
            {
                layoutManager.Deactivate();
            }
            btnZoomIn.Location = new Point(btnZoomIn.Location.X, thumbnailList1.Height - 33);
            btnZoomOut.Location = new Point(btnZoomOut.Location.X, thumbnailList1.Height - 33);
            btnZoomMouseCatcher.Location = new Point(btnZoomMouseCatcher.Location.X, thumbnailList1.Height - 33);
            layoutManager = new LayoutManager(this)
                   .Bind(btnZoomIn, btnZoomOut, btnZoomMouseCatcher)
                       .BottomTo(() => thumbnailList1.Height)
                   .Activate();

            thumbnailList1.MouseWheel += thumbnailList1_MouseWheel;
            thumbnailList1.SizeChanged += (sender, args) => layoutManager.UpdateLayout();

            notify = new NotificationManager(this, appConfigManager);
        }
Пример #11
0
        protected override void OnLoad(object sender, EventArgs e)
        {
            lvProfiles.LargeImageList = ilProfileIcons.IconsList;
            btnAdd.Enabled = !(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
            btnEdit.Enabled = false;
            btnDelete.Enabled = false;
            UpdateProfiles();
            SelectProfile(x => x.IsDefault);

            if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
            {
                contextMenuStrip.Items.Remove(ctxCopy);
                contextMenuStrip.Items.Remove(ctxPaste);
                contextMenuStrip.Items.Remove(toolStripSeparator2);
            }

            var lm = new LayoutManager(this)
                .Bind(lvProfiles)
                    .WidthToForm()
                    .HeightToForm()
                .Bind(btnAdd, btnEdit, btnDelete, btnDone)
                    .BottomToForm()
                .Bind(btnDone, btnScan)
                    .RightToForm()
                .Bind(btnEdit)
                    .LeftTo(() => btnAdd.Right)
                .Bind(btnDelete)
                    .LeftTo(() => btnEdit.Right)
                .Activate();

            iconButtonSizer.WidthOffset = 20;
            iconButtonSizer.PaddingRight = 4;
            iconButtonSizer.MaxWidth = 100;
            iconButtonSizer.ResizeButtons(btnAdd, btnEdit, btnDelete);

            lm.UpdateLayout();
        }