diff --git a/UVtools.GUI/Forms/FrmToolWindow.Designer.cs b/UVtools.GUI/Forms/FrmToolWindow.Designer.cs index c73dcd5..93f77f4 100644 --- a/UVtools.GUI/Forms/FrmToolWindow.Designer.cs +++ b/UVtools.GUI/Forms/FrmToolWindow.Designer.cs @@ -44,7 +44,6 @@ namespace UVtools.GUI.Forms this.lbLayerRangeFromMM = new System.Windows.Forms.Label(); this.lbLayerRangeToMM = new System.Windows.Forms.Label(); this.nmLayerRangeEnd = new System.Windows.Forms.NumericUpDown(); - this.btnLayerRangeSelect = new UVtools.GUI.Controls.SplitButton(); this.cmLayerRange = new System.Windows.Forms.ContextMenuStrip(this.components); this.btnLayerRangeAllLayers = new System.Windows.Forms.ToolStripMenuItem(); this.btnLayerRangeCurrentLayer = new System.Windows.Forms.ToolStripMenuItem(); @@ -53,6 +52,7 @@ namespace UVtools.GUI.Forms this.lbLayerRange = new System.Windows.Forms.Label(); this.lbLayerRangeTo = new System.Windows.Forms.Label(); this.nmLayerRangeStart = new System.Windows.Forms.NumericUpDown(); + this.btnLayerRangeSelect = new UVtools.GUI.Controls.SplitButton(); this.pnDescription.SuspendLayout(); this.pnActions.SuspendLayout(); this.pnLayerRange.SuspendLayout(); @@ -66,6 +66,7 @@ namespace UVtools.GUI.Forms // this.pnDescription.AutoSize = true; this.pnDescription.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.pnDescription.BackColor = System.Drawing.SystemColors.Control; this.pnDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pnDescription.Controls.Add(this.lbDescription); this.pnDescription.Dock = System.Windows.Forms.DockStyle.Top; @@ -88,6 +89,7 @@ namespace UVtools.GUI.Forms // // pnActions // + this.pnActions.BackColor = System.Drawing.SystemColors.Control; this.pnActions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pnActions.Controls.Add(this.btnCancel); this.pnActions.Controls.Add(this.btnOk); @@ -215,16 +217,6 @@ namespace UVtools.GUI.Forms this.nmLayerRangeEnd.TabIndex = 14; this.nmLayerRangeEnd.ValueChanged += new System.EventHandler(this.EventValueChanged); // - // btnLayerRangeSelect - // - this.btnLayerRangeSelect.Location = new System.Drawing.Point(359, 31); - this.btnLayerRangeSelect.Menu = this.cmLayerRange; - this.btnLayerRangeSelect.Name = "btnLayerRangeSelect"; - this.btnLayerRangeSelect.Size = new System.Drawing.Size(175, 26); - this.btnLayerRangeSelect.TabIndex = 18; - this.btnLayerRangeSelect.Text = "Select"; - this.btnLayerRangeSelect.UseVisualStyleBackColor = true; - // // cmLayerRange // this.cmLayerRange.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -305,10 +297,21 @@ namespace UVtools.GUI.Forms this.nmLayerRangeStart.TabIndex = 13; this.nmLayerRangeStart.ValueChanged += new System.EventHandler(this.EventValueChanged); // + // btnLayerRangeSelect + // + this.btnLayerRangeSelect.Location = new System.Drawing.Point(359, 31); + this.btnLayerRangeSelect.Menu = this.cmLayerRange; + this.btnLayerRangeSelect.Name = "btnLayerRangeSelect"; + this.btnLayerRangeSelect.Size = new System.Drawing.Size(175, 26); + this.btnLayerRangeSelect.TabIndex = 18; + this.btnLayerRangeSelect.Text = "Select"; + this.btnLayerRangeSelect.UseVisualStyleBackColor = true; + // // FrmToolWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(547, 260); this.Controls.Add(this.pnContent); diff --git a/UVtools.GUI/Forms/FrmToolWindow.cs b/UVtools.GUI/Forms/FrmToolWindow.cs index 863df42..36af217 100644 --- a/UVtools.GUI/Forms/FrmToolWindow.cs +++ b/UVtools.GUI/Forms/FrmToolWindow.cs @@ -94,31 +94,43 @@ namespace UVtools.GUI.Forms InitializeComponent(); } - public FrmToolWindow(string description, string buttonOkText, bool layerRangeVisible = true, bool layerRangeEndVisible = true) : this() + public FrmToolWindow(string title, string description, string buttonOkText, bool layerRangeVisible = true, bool layerRangeEndVisible = true, bool hideContent = false) : this() { if (!layerRangeVisible) { Height -= pnLayerRange.Height; } + if (!ReferenceEquals(title, null)) Text = title; Description = description; ButtonOkText = buttonOkText; LayerRangeVisible = layerRangeVisible; LayerRangeEndVisible = layerRangeEndVisible; LayerRangeEnd = Program.SlicerFile.LayerCount - 1; + if (hideContent) + { + Height -= pnContent.Height; + pnContent.Visible = false; + } + EventValueChanged(nmLayerRangeStart, EventArgs.Empty); EventValueChanged(nmLayerRangeEnd, EventArgs.Empty); } - public FrmToolWindow(string description, string buttonOkText, uint layerIndex) : this(description, buttonOkText) + public FrmToolWindow(string description, string buttonOkText, bool layerRangeVisible = true, bool layerRangeEndVisible = true, bool hideContent = false) : this(null, description, buttonOkText, layerRangeVisible, layerRangeEndVisible, hideContent) + { } + + public FrmToolWindow(string title, string description, string buttonOkText, uint layerIndex, bool hideContent = false) : this(title, description, buttonOkText, true, true, hideContent) { LayerRangeStart = LayerRangeEnd = layerIndex; } - public FrmToolWindow(CtrlToolWindowContent content) : this(content.Description, content.ButtonOkText, content.LayerRangeVisible, content.LayerRangeEndVisible) + public FrmToolWindow(string description, string buttonOkText, uint layerIndex, bool hideContent = false) : this(null, description, buttonOkText, layerIndex, hideContent) + { } + + public FrmToolWindow(CtrlToolWindowContent content) : this(content.Text, content.Description, content.ButtonOkText, content.LayerRangeVisible, content.LayerRangeEndVisible) { - Text = content.Text; pnContent.Controls.Add(content); Width = Math.Max(MinimumSize.Width, content.Width); Height += content.Height; @@ -271,7 +283,7 @@ namespace UVtools.GUI.Forms var text = $"({layer.PositionZ}mm)"; uint layerCount = LayerRangeEndVisible ? (uint) Math.Max(0, nmLayerRangeEnd.Value - nmLayerRangeStart.Value + 1) : 1; - lbLayerRangeCount.Text = $"({layerCount} layer / {Program.SlicerFile.LayerHeight * layerCount}mm)"; + lbLayerRangeCount.Text = $"({layerCount} layers / {Program.SlicerFile.LayerHeight * layerCount}mm)"; if (layerCount == 0) { diff --git a/UVtools.GUI/FrmMain.cs b/UVtools.GUI/FrmMain.cs index f025413..00ece46 100644 --- a/UVtools.GUI/FrmMain.cs +++ b/UVtools.GUI/FrmMain.cs @@ -983,7 +983,8 @@ namespace UVtools.GUI if (ReferenceEquals(menuItem, menuToolsLayerRemoval)) { - using (var frm = new FrmToolEmpty(ActualLayer, "Remove Layer(s)", "Removes layer(s) in a given range", "Remove")) + using (var frm = new FrmToolWindow("Remove Layer(s)", "Removes layer(s) in a given range", "Remove", ActualLayer, true)) + //using (var frm = new FrmToolEmpty(ActualLayer, "Remove Layer(s)", "Removes layer(s) in a given range", "Remove")) { if (frm.ShowDialog() != DialogResult.OK) return;