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>
75 lines
3.0 KiB
C#
75 lines
3.0 KiB
C#
using System.Diagnostics;
|
|
|
|
namespace CadSearchGui;
|
|
|
|
/// <summary>Mostra l'esito della risoluzione ricorsiva dell'albero componenti: i PRT e i
|
|
/// sotto-assiemi trovati nell'indice e già copiati in "raw" a partire dagli assiemi iniziali.</summary>
|
|
public class PrtMancantiForm : Form
|
|
{
|
|
public PrtMancantiForm(List<(string Codice, string Tipo, string Percorso)> righe, List<string> codiciNonTrovati, string cartellaRaw)
|
|
{
|
|
int numPrt = righe.Count(r => r.Tipo == "prt");
|
|
int numAsm = righe.Count(r => r.Tipo == "asm");
|
|
|
|
Text = "Componenti referenziati trovati";
|
|
ClientSize = new Size(720, 440);
|
|
StartPosition = FormStartPosition.CenterParent;
|
|
Font = new Font("Segoe UI", 9.5f);
|
|
|
|
var lblInfo = new Label
|
|
{
|
|
Dock = DockStyle.Top,
|
|
AutoSize = true,
|
|
Padding = new Padding(12, 8, 12, 8),
|
|
Text = $"Copiati in \"{cartellaRaw}\": {numPrt} PRT e {numAsm} sotto-assiemi trovati nell'indice."
|
|
+ (codiciNonTrovati.Count > 0
|
|
? $" {codiciNonTrovati.Count} codici referenziati non corrispondono a nessun file indicizzato "
|
|
+ "(righe 'non trovato' sotto: possono essere disegni, componenti davvero mancanti, "
|
|
+ "o falsi positivi della scansione)."
|
|
: ""),
|
|
};
|
|
|
|
var grid = new DataGridView
|
|
{
|
|
Dock = DockStyle.Fill,
|
|
ReadOnly = true,
|
|
AllowUserToAddRows = false,
|
|
AllowUserToDeleteRows = false,
|
|
RowHeadersVisible = false,
|
|
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
|
|
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
|
|
};
|
|
grid.Columns.Add("codice", "Codice");
|
|
grid.Columns.Add("tipo", "Tipo");
|
|
grid.Columns.Add("percorso", "Percorso CAD");
|
|
grid.Columns["codice"]!.FillWeight = 20;
|
|
grid.Columns["tipo"]!.FillWeight = 10;
|
|
grid.Columns["percorso"]!.FillWeight = 70;
|
|
foreach (var (codice, tipo, percorso) in righe.OrderBy(r => r.Tipo).ThenBy(r => r.Codice))
|
|
{
|
|
grid.Rows.Add(codice, tipo, percorso);
|
|
}
|
|
foreach (var codice in codiciNonTrovati.OrderBy(c => c))
|
|
{
|
|
int i = grid.Rows.Add(codice, "non trovato", "");
|
|
grid.Rows[i].DefaultCellStyle.ForeColor = Color.DarkRed;
|
|
}
|
|
|
|
var btnApriCartella = new Button { Text = "Apri cartella raw", Dock = DockStyle.Bottom, Height = 34 };
|
|
UiStile.Secondario(btnApriCartella);
|
|
btnApriCartella.Click += (_, _) =>
|
|
{
|
|
try { Process.Start("explorer.exe", cartellaRaw); }
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(this, $"Impossibile aprire Esplora risorse:\n{ex.Message}", "Errore",
|
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
};
|
|
|
|
Controls.Add(grid);
|
|
Controls.Add(lblInfo);
|
|
Controls.Add(btnApriCartella);
|
|
}
|
|
}
|