コード例 #1
0
 private void rdSaveToMultipleFiles_CheckedChanged(object sender, EventArgs e)
 {
     ConditionalControls.UnlockHeight(this);
     ConditionalControls.SetVisible(panelSaveSeparator, rdSaveToMultipleFiles.Checked);
     ConditionalControls.SetVisible(rdFilePerScan, !rdSingleScan.Checked && rdSaveToMultipleFiles.Checked);
     ConditionalControls.LockHeight(this);
 }
コード例 #2
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);
            }

            new LayoutManager(this)
            .Bind(tbAngle, pictureBox)
            .WidthToForm()
            .Bind(pictureBox)
            .HeightToForm()
            .Bind(btnOK, btnCancel, txtAngle)
            .RightToForm()
            .Bind(tbAngle, txtAngle, checkboxApplyToSelected, btnRevert, btnOK, btnCancel)
            .BottomToForm()
            .Activate();
            Size = new Size(600, 600);

            workingImage     = scannedImageRenderer.Render(Image);
            pictureBox.Image = (Bitmap)workingImage.Clone();
            txtAngle.Text   += '\u00B0';
            UpdatePreviewBox();

            ActiveControl = txtAngle;
        }
コード例 #3
0
ファイル: FAbout.cs プロジェクト: msadeqsirjani/Ray.Scanner
        protected override void OnLoad(object sender, EventArgs eventArgs)
        {
            new LayoutManager(this)
            .Bind(logoPictureBox)
            .TopTo(() => Height / 2)
            .Activate();

#if INSTALLER_MSI
            ConditionalControls.Hide(cbCheckForUpdates, 15);
            ConditionalControls.Hide(lblUpdateStatus, 5);
#else
            cbCheckForUpdates.Checked = userConfigManager.Config.CheckForUpdates;
            UpdateControls();
            DoUpdateCheck();
#endif
        }
コード例 #4
0
ファイル: FBatchScan.cs プロジェクト: royal50911/naps2
        protected override void OnLoad(object sender, EventArgs eventArgs)
        {
            new LayoutManager(this)
            .Bind(groupboxScanConfig, groupboxOutput,
                  panelSaveSeparator, panelSaveTo, panelSaveType, panelScanDetails, panelScanType,
                  comboProfile, txtFilePath, lblStatus)
            .WidthToForm()
            .Bind(btnEditProfile, btnAddProfile, btnStart, btnCancel, btnChooseFolder)
            .RightToForm()
            .Activate();

            ConditionalControls.LockHeight(this);

            BatchSettings = userConfigManager.Config.LastBatchSettings ?? new BatchSettings();
            UpdateUIFromSettings();
        }
コード例 #5
0
        protected override void OnLoad(object sender, EventArgs eventArgs)
        {
            new LayoutManager(this)
            .Bind(btnCancel, btnOK)
            .RightToForm()
            .Bind(comboLanguages, comboOcrMode)
            .WidthToForm()
            .Activate();

            LoadLanguages();
            comboLanguages.DisplayMember = "Name";
            comboLanguages.ValueMember   = "Code";

            ConditionalControls.UnlockHeight(this);
            ConditionalControls.SetVisible(comboOcrMode, availableModes != null, 8);
            labelOcrMode.Visible = availableModes != null;
            ConditionalControls.LockHeight(this);

            if (appConfigManager.Config.OcrState == OcrState.Enabled)
            {
                checkBoxEnableOcr.Checked = true;
                SetSelectedValue(comboLanguages, appConfigManager.Config.OcrDefaultLanguage ?? "");
                SetSelectedItem(comboOcrMode, appConfigManager.Config.OcrDefaultMode);
                checkBoxRunInBG.Checked = appConfigManager.Config.OcrDefaultAfterScanning;
            }
            else if (appConfigManager.Config.OcrState == OcrState.Disabled)
            {
                checkBoxEnableOcr.Checked    = false;
                comboLanguages.SelectedValue = "";
                comboOcrMode.SelectedValue   = "";
                checkBoxRunInBG.Checked      = false;
            }
            else
            {
                checkBoxEnableOcr.Checked = UserConfigManager.Config.EnableOcr;
                SetSelectedValue(comboLanguages, UserConfigManager.Config.OcrLanguageCode ?? appConfigManager.Config.OcrDefaultLanguage ?? "");
                SetSelectedItem(comboOcrMode, UserConfigManager.Config.OcrMode == OcrMode.Default ? appConfigManager.Config.OcrDefaultMode : UserConfigManager.Config.OcrMode);
                checkBoxRunInBG.Checked = UserConfigManager.Config.OcrAfterScanning ?? appConfigManager.Config.OcrDefaultAfterScanning;
            }

            UpdateView();
        }
コード例 #6
0
ファイル: ImageForm.cs プロジェクト: damieng/naps2
        private async void ImageForm_Load(object sender, EventArgs e)
        {
            checkboxApplyToSelected.BringToFront();
            btnRevert.BringToFront();
            btnCancel.BringToFront();
            btnOK.BringToFront();
            if (SelectedImages != null && SelectedImages.Count > 1)
            {
                checkboxApplyToSelected.Text = string.Format(checkboxApplyToSelected.Text, SelectedImages.Count);
            }
            else
            {
                ConditionalControls.Hide(checkboxApplyToSelected, 6);
            }

            Size = new Size(600, 600);

            var maxDimen = Screen.AllScreens.Max(s => Math.Max(s.WorkingArea.Height, s.WorkingArea.Width));

            if (scannedImageRenderer == null)
            {
                return;
            }

            workingImage = await scannedImageRenderer.Render(Image, maxDimen * 2);

            if (closed)
            {
                workingImage?.Dispose();
                return;
            }
            workingImage2 = (Bitmap)workingImage.Clone();

            InitTransform();
            lock (this)
            {
                initComplete = true;
            }

            UpdatePreviewBox();
        }
コード例 #7
0
ファイル: FAbout.cs プロジェクト: msadeqsirjani/Ray.Scanner
        private void UpdateControls()
        {
            const int margin = 5;

            if (cbCheckForUpdates.Checked)
            {
                if (lblUpdateStatus.Visible == false && linkInstall.Visible == false)
                {
                    ConditionalControls.Show(lblUpdateStatus, margin);
                }
                if (hasCheckedForUpdates)
                {
                    if (update == null)
                    {
                        lblUpdateStatus.Text    = MiscResources.NoUpdates;
                        lblUpdateStatus.Visible = true;
                        linkInstall.Visible     = false;
                    }
                    else
                    {
                        linkInstall.Text        = string.Format(MiscResources.Install, update.Name);
                        lblUpdateStatus.Visible = false;
                        linkInstall.Visible     = true;
                    }
                }
                else
                {
                    lblUpdateStatus.Text    = MiscResources.CheckingForUpdates;
                    lblUpdateStatus.Visible = true;
                    linkInstall.Visible     = false;
                }
            }
            else
            {
                ConditionalControls.Hide(lblUpdateStatus, margin);
                ConditionalControls.Hide(linkInstall, margin);
            }
        }
コード例 #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  = scannedImageRenderer.Render(Image);
            workingImage2 = scannedImageRenderer.Render(Image);
            UpdateCropBounds();
            UpdatePreviewBox();

            lm.UpdateLayout();
        }
コード例 #9
0
 private void rdLoadIntoNaps2_CheckedChanged(object sender, EventArgs e)
 {
     ConditionalControls.UnlockHeight(this);
     ConditionalControls.SetVisible(panelSaveTo, !rdLoadIntoNaps2.Checked);
     ConditionalControls.LockHeight(this);
 }
コード例 #10
0
 private void rdMultipleScansDelay_CheckedChanged(object sender, EventArgs e)
 {
     ConditionalControls.UnlockHeight(this);
     ConditionalControls.SetVisible(panelScanDetails, rdMultipleScansDelay.Checked);
     ConditionalControls.LockHeight(this);
 }