Skip to content

WinForms: Enable maximize/minimize buttons on resizable Eto dialogs#810

Open
navara wants to merge 1 commit into
cyanfish:masterfrom
navara:claude/heuristic-lichterman-d4147a
Open

WinForms: Enable maximize/minimize buttons on resizable Eto dialogs#810
navara wants to merge 1 commit into
cyanfish:masterfrom
navara:claude/heuristic-lichterman-d4147a

Conversation

@navara
Copy link
Copy Markdown

@navara navara commented Apr 30, 2026

Summary

Fixes #755 — the title-bar maximize button is greyed out on ~30 NAPS2 dialogs on Windows (Preview, Crop, Settings, EditProfile, etc.) even though the windows are user-resizable by drag.

Root cause

Eto.Forms 2.8.3's Eto.WinForms.Forms.DialogHandler constructor hardcodes MaximizeBox = false and MinimizeBox = false on the underlying WF.Form. NAPS2's EtoDialogBase sets Resizable = true, but Eto's Resizable setter only changes FormBorderStyle (e.g. to Sizable); it does not touch MaximizeBox/MinimizeBox. Net effect: the form is resizable by drag-handles but the title-bar maximize button stays disabled.

The main window (DesktopForm via EtoFormBase → Eto Form) is unaffected because Eto's FormHandler leaves MaximizeBox = true.

Change

Centralized fix in the platform abstraction — no per-dialog edits.

  • EtoPlatform.cs — new no-op virtual SetFormMaximizable(Window, bool).
  • WinFormsEtoPlatform.cs — override sets MaximizeBox and MinimizeBox on WF.Form.
  • FormStateController.cs — call from OnShownInternal, immediately after _window.Resizable = Resizable;.

MinimizeBox is coupled to MaximizeBox (both follow the single bool): Eto's DialogHandler disabled both, an asymmetric title bar would look odd, and the main DesktopForm already shows both.

Mac/GTK keep the no-op base implementation — those platforms already wire Window.Resizable to native maximize behavior via Eto's own handlers.

Affected windows

Now correctly maximizable (~30): Preview, Crop, BlackWhite, BrightCont, HueSat, Sharpen, Rotate, Split, Combine, AdvancedProfile, EditProfile, Settings, Image/Pdf/Email Settings, KeyboardShortcuts, Profiles, Placeholders, ChooseDevice, BatchScan, ScannerSharing, SharedDevice, Resolution, PageSize, AutoSaveSettings, OcrDownload, OcrMultiLang, DownloadProgress, PdfPassword, ManualIp, Error, Progress, EditWith, EmailProvider.

Intentionally unchanged (FormStateController.Resizable = false): About, Authorize, BatchPrompt, OcrSetup, Recover. Their FormBorderStyle = FixedDialog still hides the maximize button.

DesktopForm: unchanged.

Bonus

Per-form Maximized state is already saved in FormState (FormStateController.cs:166) and restored on load. With this fix, dialogs can actually become maximized, so that pre-existing facility starts producing user-visible value.

Eto.Forms' WinForms DialogHandler hardcodes MaximizeBox=false and
MinimizeBox=false. Setting Resizable=true only changes FormBorderStyle,
so all ~30 NAPS2 dialogs derived from EtoDialogBase (Preview, Crop,
Settings, EditProfile, etc.) had a greyed-out maximize button despite
being resizable by drag.

Add SetFormMaximizable(Window, bool) to EtoPlatform (no-op default;
WinForms override sets MaximizeBox/MinimizeBox on the underlying
WF.Form), and call it from FormStateController.OnShownInternal right
after _window.Resizable is applied. Mac/GTK behavior is unchanged
since their handlers already wire Resizable to native maximize behavior.

Fixes cyanfish#755
@cyanfish
Copy link
Copy Markdown
Owner

cyanfish commented May 3, 2026

I'd rather just set Maximizable = true on ImageFormBase and PreviewForm. Minimizable = true will interact weirdly with dialogs, and allowing windows with partially fixed dimensions like PdfSettingsForm to be maximized will also cause weirdness.

@navara
Copy link
Copy Markdown
Author

navara commented May 3, 2026

I guess it cannot hurt, as long as it doesn't interfere with Restore part of maximization (though that might not be needed as long as Close button is visible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maximize button for certain windows is disabled

2 participants