Fix overflowing/clipped UI text and give buttons a consistent flat style
Instruction and status labels used AutoSize/fixed widths with no wrap constraint, so long Italian paragraphs and network paths ran past the window edge or got clipped instead of wrapping. Report dialogs had fixed-height labels that clipped multi-line text. ProgressForm's folder label could overflow its non-resizable dialog. - Labels now wrap responsively (TableLayoutPanel column at 100% + Dock=Top) instead of a fixed pixel cap, so they reflow when the window is resized. - Report dialog labels switched from fixed Height to AutoSize. - ProgressForm's folder label truncates with ellipsis + tooltip, matching the existing pattern used by the import status label. - Added ApplicationHighDpiMode=PerMonitorV2 to fix control proportions on scaled displays. - Added UiStile.cs: shared flat button style (primary/secondary), rounded corners for the wizard nav buttons, and AutoSize+padding on all buttons so button size always matches its text (fixes text getting clipped when a hardcoded Size was too narrow for the label). - Fase 5's drag&drop .asm list now fills available vertical space instead of a fixed 680x160 box. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6511d58b01
commit
ba18d682f3
8 files changed
+166
-64
No files matched your search
@@ -0,0 +1,72 @@
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace CadSearchGui;
|
||||
|
||||
/// <summary>Stile bottoni condiviso tra la form principale e i dialog secondari: piatto con
|
||||
/// bordo sottile e hover, per un aspetto coerente sia per l'azione primaria di ogni fase
|
||||
/// (blu pieno) sia per le azioni secondarie, al posto del bottone grigio di default.</summary>
|
||||
internal static class UiStile
|
||||
{
|
||||
// AutoSize+Padding invece di una Size fissa in pixel: il bottone si dimensiona sempre
|
||||
// al proprio testo (a qualunque lunghezza/font), niente più testo che va a capo e viene
|
||||
// tagliato in verticale quando non ci sta nella larghezza indovinata a mano.
|
||||
private static void DimensionamentoAutomatico(Button b)
|
||||
{
|
||||
b.AutoSize = true;
|
||||
b.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
b.Padding = new Padding(18, 4, 18, 4);
|
||||
b.MinimumSize = new Size(0, 32);
|
||||
}
|
||||
|
||||
public static void Primario(Button b)
|
||||
{
|
||||
DimensionamentoAutomatico(b);
|
||||
b.FlatStyle = FlatStyle.Flat;
|
||||
b.FlatAppearance.BorderSize = 0;
|
||||
b.FlatAppearance.MouseOverBackColor = Color.FromArgb(0, 84, 152);
|
||||
b.FlatAppearance.MouseDownBackColor = Color.FromArgb(0, 70, 130);
|
||||
b.BackColor = Color.FromArgb(0, 99, 177);
|
||||
b.ForeColor = Color.White;
|
||||
b.Font = new Font(b.Font, FontStyle.Bold);
|
||||
b.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
public static void Secondario(Button b)
|
||||
{
|
||||
DimensionamentoAutomatico(b);
|
||||
b.FlatStyle = FlatStyle.Flat;
|
||||
b.FlatAppearance.BorderColor = Color.FromArgb(190, 195, 200);
|
||||
b.FlatAppearance.BorderSize = 1;
|
||||
b.FlatAppearance.MouseOverBackColor = Color.FromArgb(230, 238, 245);
|
||||
b.FlatAppearance.MouseDownBackColor = Color.FromArgb(213, 226, 238);
|
||||
b.BackColor = Color.White;
|
||||
b.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
/// <summary>Arrotonda gli angoli del bottone. Si aggancia a SizeChanged invece di calcolare
|
||||
/// la Region una volta sola: con AutoSize la dimensione finale si conosce solo a layout
|
||||
/// avvenuto (dopo Text/Padding), non subito dopo la creazione del controllo.</summary>
|
||||
public static void Arrotonda(Button b, int raggio = 6)
|
||||
{
|
||||
b.SizeChanged += (_, _) => AggiornaRegione(b, raggio);
|
||||
AggiornaRegione(b, raggio);
|
||||
}
|
||||
|
||||
private static void AggiornaRegione(Button b, int raggio)
|
||||
{
|
||||
if (b.Width <= 0 || b.Height <= 0)
|
||||
return;
|
||||
|
||||
int d = raggio * 2;
|
||||
var rect = new Rectangle(Point.Empty, b.Size);
|
||||
using var percorso = new GraphicsPath();
|
||||
percorso.AddArc(rect.X, rect.Y, d, d, 180, 90);
|
||||
percorso.AddArc(rect.Right - d, rect.Y, d, d, 270, 90);
|
||||
percorso.AddArc(rect.Right - d, rect.Bottom - d, d, d, 0, 90);
|
||||
percorso.AddArc(rect.X, rect.Bottom - d, d, d, 90, 90);
|
||||
percorso.CloseFigure();
|
||||
|
||||
b.Region?.Dispose();
|
||||
b.Region = new Region(percorso);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user