本文整理汇总了C#中MatterHackers.Agg.UI.FlowLayoutWidget.CloseAndRemoveAllChildren方法的典型用法代码示例。如果您正苦于以下问题:C# FlowLayoutWidget.CloseAndRemoveAllChildren方法的具体用法?C# FlowLayoutWidget.CloseAndRemoveAllChildren怎么用?C# FlowLayoutWidget.CloseAndRemoveAllChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.UI.FlowLayoutWidget
的用法示例。
在下文中一共展示了FlowLayoutWidget.CloseAndRemoveAllChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDisplayControls
private void AddDisplayControls(FlowLayoutWidget buttonPanel)
{
buttonPanel.CloseAndRemoveAllChildren();
double oldWidth = textImageButtonFactory.FixedWidth;
textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio;
FlowLayoutWidget layerInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
layerInfoContainer.HAnchor = HAnchor.ParentLeftRight;
layerInfoContainer.Padding = new BorderDouble(5);
// put in a show grid check box
{
CheckBox showGrid = new CheckBox(LocalizedString.Get("Grid"), textColor: ActiveTheme.Instance.PrimaryTextColor);
showGrid.Checked = gcodeViewWidget.RenderGrid;
meshViewerWidget.RenderBed = showGrid.Checked;
showGrid.CheckedStateChanged += (sender, e) =>
{
gcodeViewWidget.RenderGrid = showGrid.Checked;
meshViewerWidget.RenderBed = showGrid.Checked;
};
layerInfoContainer.AddChild(showGrid);
}
// put in a show moves checkbox
{
CheckBox showMoves = new CheckBox(LocalizedString.Get("Moves"), textColor: ActiveTheme.Instance.PrimaryTextColor);
showMoves.Checked = gcodeViewWidget.RenderMoves;
showMoves.CheckedStateChanged += (sender, e) =>
{
gcodeViewWidget.RenderMoves = showMoves.Checked;
};
layerInfoContainer.AddChild(showMoves);
}
// put in a show Retractions checkbox
{
CheckBox showRetractions = new CheckBox(LocalizedString.Get("Retractions"), textColor: ActiveTheme.Instance.PrimaryTextColor);
showRetractions.Checked = gcodeViewWidget.RenderRetractions;
showRetractions.CheckedStateChanged += (sender, e) =>
{
gcodeViewWidget.RenderRetractions = showRetractions.Checked;
};
layerInfoContainer.AddChild(showRetractions);
}
// put in a show speed checkbox
{
showSpeeds = new CheckBox(LocalizedString.Get("Speeds"), textColor: ActiveTheme.Instance.PrimaryTextColor);
showSpeeds.Checked = gcodeViewWidget.RenderSpeeds;
//showSpeeds.Checked = gradient.Visible;
showSpeeds.CheckedStateChanged += (sender, e) =>
{
/* if (!showSpeeds.Checked)
{
gradient.Visible = false;
}
else
{
gradient.Visible = true;
}*/
gradientWidget.Visible = showSpeeds.Checked;
gcodeViewWidget.RenderSpeeds = showSpeeds.Checked;
};
layerInfoContainer.AddChild(showSpeeds);
}
// put in a simulate extrusion checkbox
{
CheckBox simulateExtrusion = new CheckBox(LocalizedString.Get("Extrusion"), textColor: ActiveTheme.Instance.PrimaryTextColor);
simulateExtrusion.Checked = gcodeViewWidget.SimulateExtrusion;
simulateExtrusion.CheckedStateChanged += (sender, e) =>
{
gcodeViewWidget.SimulateExtrusion = simulateExtrusion.Checked;
};
layerInfoContainer.AddChild(simulateExtrusion);
}
// put in a simulate extrusion checkbox
if (ActiveSliceSettings.Instance.ExtruderCount > 1)
{
CheckBox hideExtruderOffsets = new CheckBox("Hide Offsets", textColor: ActiveTheme.Instance.PrimaryTextColor);
hideExtruderOffsets.Checked = gcodeViewWidget.HideExtruderOffsets;
hideExtruderOffsets.CheckedStateChanged += (sender, e) =>
{
gcodeViewWidget.HideExtruderOffsets = hideExtruderOffsets.Checked;
};
layerInfoContainer.AddChild(hideExtruderOffsets);
}
// put in a show 3D view checkbox
{
viewControlsToggle.twoDimensionButton.CheckedStateChanged += (sender, e) =>
{
SetLayerViewType();
};
viewControlsToggle.threeDimensionButton.CheckedStateChanged += (sender, e) =>
//.........这里部分代码省略.........
示例2: AddModelInfo
private void AddModelInfo(FlowLayoutWidget buttonPanel)
{
buttonPanel.CloseAndRemoveAllChildren();
double oldWidth = textImageButtonFactory.FixedWidth;
textImageButtonFactory.FixedWidth = 44 * TextWidget.GlobalPointSizeScaleRatio;
FlowLayoutWidget modelInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
modelInfoContainer.HAnchor = HAnchor.ParentLeftRight;
modelInfoContainer.Padding = new BorderDouble(5);
string printTimeLabel = "Print Time".Localize().ToUpper();
string printTimeLabelFull = string.Format("{0}:", printTimeLabel);
// put in the print time
modelInfoContainer.AddChild(new TextWidget(printTimeLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10));
{
string timeRemainingText = "---";
if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode != null)
{
int secondsRemaining = (int)gcodeViewWidget.LoadedGCode.Instruction(0).secondsToEndFromHere;
int hoursRemaining = (int)(secondsRemaining / (60 * 60));
int minutesRemaining = (int)((secondsRemaining + 30) / 60 - hoursRemaining * 60); // +30 for rounding
secondsRemaining = secondsRemaining % 60;
if (hoursRemaining > 0)
{
timeRemainingText = string.Format("{0} h, {1} min", hoursRemaining, minutesRemaining);
}
else
{
timeRemainingText = string.Format("{0} min", minutesRemaining);
}
}
GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0}", timeRemainingText), textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 14);
//estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
modelInfoContainer.AddChild(estimatedPrintTime);
}
//modelInfoContainer.AddChild(new TextWidget("Size:", textColor: ActiveTheme.Instance.PrimaryTextColor));
string filamentLengthLabel = "Filament Length".Localize().ToUpper();
string filamentLengthLabelFull = string.Format("{0}:", filamentLengthLabel);
// show the filament used
modelInfoContainer.AddChild(new TextWidget(filamentLengthLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9));
{
double filamentUsed = gcodeViewWidget.LoadedGCode.GetFilamentUsedMm(ActiveSliceSettings.Instance.FilamentDiameter);
GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.0} mm", filamentUsed), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
//estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
modelInfoContainer.AddChild(estimatedPrintTime);
}
string filamentVolumeLabel = "Filament Volume".Localize().ToUpper();
string filamentVolumeLabelFull = string.Format("{0}:", filamentVolumeLabel);
modelInfoContainer.AddChild(new TextWidget(filamentVolumeLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9));
{
double filamentMm3 = gcodeViewWidget.LoadedGCode.GetFilamentCubicMm(ActiveSliceSettings.Instance.FilamentDiameter);
GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} cm3", filamentMm3 / 1000), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
//estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
modelInfoContainer.AddChild(estimatedPrintTime);
}
string weightLabel = "Est. Weight".Localize().ToUpper();
string weightLabelFull = string.Format("{0}:", weightLabel);
modelInfoContainer.AddChild(new TextWidget(weightLabelFull, pointSize: 9, textColor: ActiveTheme.Instance.PrimaryTextColor));
{
var density = 1.0;
string filamentType = "PLA";
if (filamentType == "ABS")
{
density = 1.04;
}
else if (filamentType == "PLA")
{
density = 1.24;
}
double filamentWeightGrams = gcodeViewWidget.LoadedGCode.GetFilamentWeightGrams(ActiveSliceSettings.Instance.FilamentDiameter, density);
GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} g", filamentWeightGrams), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
//estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
modelInfoContainer.AddChild(estimatedPrintTime);
}
//modelInfoContainer.AddChild(new TextWidget("Layer Count:", textColor: ActiveTheme.Instance.PrimaryTextColor));
buttonPanel.AddChild(modelInfoContainer);
textImageButtonFactory.FixedWidth = oldWidth;
}