本文整理汇总了C#中WinterLeaf.Engine.Classes.View.Creators.ObjectCreator.setPosition方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectCreator.setPosition方法的具体用法?C# ObjectCreator.setPosition怎么用?C# ObjectCreator.setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WinterLeaf.Engine.Classes.View.Creators.ObjectCreator
的用法示例。
在下文中一共展示了ObjectCreator.setPosition方法的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);
}
}