public override Control CreateUI() { ui = new Panel(); ui.SuspendLayout(); ui.Font = CurFocusPanel?.Font; ui.AutoSize = true; if (text != null) { testItem = new Label(); testItem.Text = text; testItem.Left = ControlsGap; testItem.Font = ui.Font; testItem.AutoSize = true; ui.Controls.Add(testItem); } if (hasTested) { lbResult = new Label(); lbResult.Text = resultDescribe; lbResult.Left = (testItem?.Left ?? 0) + ControlsGap; testItem.AutoSize = true; ui.Controls.Add(lbResult); } if (hasAppendSet) { Label lb = new Label(); lb.Text = "切面高度"; lb.Left = CurFocusPanel.Width / 2 - 2 * ControlsGap; lb.AutoSize = true; ui.Controls.Add(lb); TextBox tb = new TextBox(); tb.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); tb.Left = lb.Right + ControlsGap; tb.Size = new System.Drawing.Size(32, 23); tb.TextChanged += Tb_TextChanged; ui.Controls.Add(tb); Label lb1 = new Label(); lb1.Text = backUnit; lb1.Left = tb.Right + ControlsGap; lb1.AutoSize = true; ui.Controls.Add(lb1); } slideControl = new EditorRangeForm(backUnit, minValue, maxValue, leftValue, rightValue, isLargeValueOk); slideControl.DataChanged += SlideControl_DataChanged; if (testItem != null) { slideControl.Top = testItem.Bottom + ControlsGap; } else { slideControl.Top = ControlsGap; } slideControl.Left = ControlsGap; ui.Controls.Add(slideControl); //ui.Width = slideControl.Width; //ui.Height = slideControl.Bottom + ControlsGap; ui.ResumeLayout(); return(ui); }
public override void DisposeUIManual() { if (null != this.slideControl) { this.slideControl.RemoveAllDelegate(); this.slideControl.Dispose(); this.slideControl = null; } if (null != ui) { ui.Dispose(); ui = null; } }