Revise ToggleSwitch UIField to match sibling widths

- Issue MatterHackers/MCCentral#2020
Improve UIField sizing and positions
This commit is contained in:
John Lewin 2017-10-01 18:24:12 -07:00
parent 4947ac483c
commit 6881e3ed3b
3 changed files with 23 additions and 12 deletions

View file

@ -70,10 +70,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public override void Initialize(int tabIndex)
{
checkBoxWidget = ImageButtonFactory.CreateToggleSwitch(false, ActiveTheme.Instance.PrimaryTextColor, useStandardLabels: false);
var pixelWidth = this.ControlWidth + 6; // HACK: work around agg-bug where text fields are padding*2 bigger than ControlWidth
checkBoxWidget = ImageButtonFactory.CreateToggleSwitch(false, ActiveTheme.Instance.PrimaryTextColor, pixelWidth, pixelHeight: 24 * GuiWidget.DeviceScale, useStandardLabels: false);
checkBoxWidget.VAnchor = VAnchor.Center;
checkBoxWidget.Name = this.Name;
checkBoxWidget.Margin = new BorderDouble(0);
checkBoxWidget.Margin = 0;
checkBoxWidget.Click += (s, e) =>
{
Console.WriteLine("Checkbox Click Event: " + this.checkBoxWidget.Checked);