本文整理汇总了C#中GuiWidget.OnDrawBackground方法的典型用法代码示例。如果您正苦于以下问题:C# GuiWidget.OnDrawBackground方法的具体用法?C# GuiWidget.OnDrawBackground怎么用?C# GuiWidget.OnDrawBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiWidget
的用法示例。
在下文中一共展示了GuiWidget.OnDrawBackground方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureFlowLayoutMinSizeFitsChildrenMinSize
public void EnsureFlowLayoutMinSizeFitsChildrenMinSize()
{
// This test is to prove that a flow layout widget always has it's min size set
// to the enclosing bounds size of all it's childrens min size.
// The code to be tested will expand the flow layouts min size as it's children's min size change.
GuiWidget containerTest = new GuiWidget(640, 480);
FlowLayoutWidget topToBottomFlowLayoutAll = new FlowLayoutWidget(FlowDirection.TopToBottom);
containerTest.AddChild(topToBottomFlowLayoutAll);
containerTest.DoubleBuffer = true;
FlowLayoutWidget topLeftToRight = new FlowLayoutWidget(FlowDirection.LeftToRight);
topToBottomFlowLayoutAll.AddChild(topLeftToRight);
GuiWidget bottomLeftToRight = new FlowLayoutWidget(FlowDirection.LeftToRight);
topToBottomFlowLayoutAll.AddChild(bottomLeftToRight);
topLeftToRight.AddChild(new Button("top button"));
FlowLayoutWidget bottomContentTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
bottomLeftToRight.AddChild(bottomContentTopToBottom);
Button button1 = new Button("button1");
Assert.IsTrue(button1.MinimumSize.x > 0, "Buttons should set their min size on construction.");
bottomContentTopToBottom.AddChild(button1);
//Assert.IsTrue(bottomContentTopToBottom.MinimumSize.x >= button1.MinimumSize.x, "There should be space for the button.");
bottomContentTopToBottom.AddChild(new Button("button2"));
Button wideButton = new Button("button3 Wide");
bottomContentTopToBottom.AddChild(wideButton);
//Assert.IsTrue(bottomContentTopToBottom.MinimumSize.x >= wideButton.MinimumSize.x, "These should be space for the button.");
containerTest.BackgroundColor = RGBA_Bytes.White;
containerTest.OnDrawBackground(containerTest.NewGraphics2D());
containerTest.OnDraw(containerTest.NewGraphics2D());
OutputImage(containerTest.BackBuffer, "zFlowLaoutsGetMinSize.tga");
Assert.IsTrue(bottomLeftToRight.Width > 0, "This needs to have been expanded when the bottomContentTopToBottom grew.");
Assert.IsTrue(bottomLeftToRight.MinimumSize.x >= bottomContentTopToBottom.MinimumSize.x, "These should be space for the next flowLayout.");
Assert.IsTrue(containerTest.BackBuffer != null, "When we set a guiWidget to DoubleBuffer it needs to create one.");
}