本文整理匯總了C#中WinterLeaf.Engine.Classes.View.Creators.ObjectCreator.addGuiControl方法的典型用法代碼示例。如果您正苦於以下問題:C# ObjectCreator.addGuiControl方法的具體用法?C# ObjectCreator.addGuiControl怎麽用?C# ObjectCreator.addGuiControl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WinterLeaf.Engine.Classes.View.Creators.ObjectCreator
的用法示例。
在下文中一共展示了ObjectCreator.addGuiControl方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: group
/// Create a new GuiControl and move all the controls contained in the GuiEditorGroup into it.
public void group()
{
GuiControl parent = this.groupParent;
// Create group.
GuiControl group = new ObjectCreator("GuiControl").Create();
parent.addGuiControl(group);
this.groupObject = group;
// Make group fit around selection.
string bounds = this.getGlobalBounds();
string parentGlobalPos = parent.getGlobalPosition().AsString();
int x = Util.getWord(bounds, 0).AsInt() - Util.getWord(parentGlobalPos, 0).AsInt();
int y = Util.getWord(bounds, 1).AsInt() - Util.getWord(parentGlobalPos, 1).AsInt();
group.setPosition(x, y);
group.setExtent(new Point2F(Util.getWord(bounds, 2).AsFloat(), Util.getWord(bounds, 3).AsFloat()));
// Reparent all objects to group.
for (int i = 0; i < this.count; i ++)
{
GuiControl ctrl = this["ctrl[" + i + "]"];
// Save parent for undo.
this["ctrlParent[" + i + "]"] = ctrl.parentGroup;
// Reparent.
group.addGuiControl(ctrl);
// Move into place in new parent.
string pos = ctrl.getPosition().AsString();
ctrl.setPosition(Util.getWord(pos, 0).AsInt() - x, Util.getWord(pos, 1).AsInt() - y);
}
}