本文整理汇总了C#中Gwen.Control.Base.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Base.SetPosition方法的具体用法?C# Base.SetPosition怎么用?C# Base.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gwen.Control.Base
的用法示例。
在下文中一共展示了Base.SetPosition方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CenterVertically
/// <summary>
/// Centers the control vertically inside its parent.
/// </summary>
/// <param name="control"></param>
public static void CenterVertically(Base control)
{
Base parent = control.Parent;
if (null == parent) return;
control.SetPosition(control.X, (parent.Height - control.Height) / 2);
}
示例2: ScrollControl
/// <summary>
/// Initializes a new instance of the <see cref="ScrollControl"/> class.
/// </summary>
/// <param name="parent">Parent control.</param>
public ScrollControl(Base parent)
: base(parent)
{
MouseInputEnabled = false;
m_VerticalScrollBar = new VerticalScrollBar(this);
m_VerticalScrollBar.Dock = Pos.Right;
m_VerticalScrollBar.BarMoved += VBarMoved;
m_CanScrollV = true;
m_VerticalScrollBar.NudgeAmount = 30;
m_HorizontalScrollBar = new HorizontalScrollBar(this);
m_HorizontalScrollBar.Dock = Pos.Bottom;
m_HorizontalScrollBar.BarMoved += HBarMoved;
m_CanScrollH = true;
m_HorizontalScrollBar.NudgeAmount = 30;
m_InnerPanel = new Base(this);
m_InnerPanel.SetPosition(0, 0);
m_InnerPanel.Margin = Margin.Five;
m_InnerPanel.SendToBack();
m_InnerPanel.MouseInputEnabled = false;
m_AutoHideBars = false;
}
示例3: AlignRight
/// <summary>
/// Moves the control to the right of its parent.
/// </summary>
/// <param name="control"></param>
public static void AlignRight(Base control)
{
Base parent = control.Parent;
if (null == parent) return;
control.SetPosition(parent.Width - control.Width - parent.Padding.Right, control.Y);
}
示例4: AlignLeft
/// <summary>
/// Moves the control to the left of its parent.
/// </summary>
/// <param name="control"></param>
public static void AlignLeft(Base control)
{
Base parent = control.Parent;
if (null == parent) return;
control.SetPosition(parent.Padding.Left, control.Y);
}
示例5: AlignBottom
/// <summary>
/// Moves the control to the bottom of its parent.
/// </summary>
/// <param name="control"></param>
public static void AlignBottom(Base control)
{
Base parent = control.Parent;
if (null == parent) return;
control.SetPosition(control.X, parent.Height - control.Height);
}
示例6: CenterHorizontally
/// <summary>
/// Centers the control horizontally inside its parent.
/// </summary>
/// <param name="control"></param>
public static void CenterHorizontally(Base control)
{
Base parent = control.Parent;
if (null == parent) return;
control.SetPosition(parent.Padding.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width) / 2), control.Y);
}
示例7: Center
/// <summary>
/// Centers the control inside its parent.
/// </summary>
/// <param name="control">Control to center.</param>
public static void Center(Base control)
{
Base parent = control.Parent;
if (parent == null)
return;
control.SetPosition(
parent.Padding.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width)/2),
(parent.Height - control.Height)/2);
}
示例8: AlignTop
/// <summary>
/// Moves the control to the top of its parent.
/// </summary>
/// <param name="control"></param>
public static void AlignTop(Base control)
{
control.SetPosition(control.X, 0);
}
示例9: PlaceRightBottom
/// <summary>
/// Places the control to the right of other control (bottom aligned), taking margins into account.
/// </summary>
/// <param name="control">Control to place.</param>
/// <param name="anchor">Anchor control.</param>
/// <param name="spacing">Optional spacing.</param>
public static void PlaceRightBottom(Base control, Base anchor, int spacing = 0)
{
control.SetPosition(anchor.Right + spacing, anchor.Y - control.Height + anchor.Height);
}
示例10: PlaceDownLeft
/// <summary>
/// Places the control below other control (left aligned), taking margins into account.
/// </summary>
/// <param name="control">Control to place.</param>
/// <param name="anchor">Anchor control.</param>
/// <param name="spacing">Optional spacing.</param>
public static void PlaceDownLeft(Base control, Base anchor, int spacing = 0)
{
control.SetPosition(anchor.X, anchor.Bottom + spacing);
}
示例11: Main
public static void Main(string[] args) {
g_testEntries = AllTests.GetTests();
testCount = g_testEntries.Count();
testIndex = Math.Max(0, Math.Min(testIndex, testCount - 1));
testSelection = testIndex;
entry = g_testEntries[testIndex];
test = entry.createFcn();
GraphicsManager.SetWindowState(OpenTK.WindowState.Maximized);
string title = String.Format("Box2D Version {0}.{1}.{2}", Settings._version.major, Settings._version.minor, Settings._version.revision);
GraphicsManager.SetTitle(title);
camera = new Camera2D();
camera.OnRender += SimulationLoop;
camera.SetZoom(12);
camera.CenterOnTarget(true);
camera.SetLocation(0, 0);
GraphicsManager.Update += new GraphicsManager.Updater(GraphicsManager_Update);
WindowControl glui = new WindowControl(MainCanvas.GetCanvas());
glui.Dock = Gwen.Pos.Left;
Label text = new Label(glui);
text.Text = "Tests";
text.SetPosition(10, 10);
testList = new ListBox(glui);
testList.RowSelected += delegate(Base sender, ItemSelectedEventArgs tlargs) {
testSelection = testList.SelectedRowIndex;
};
foreach (TestEntry e in g_testEntries) {
testList.AddRow(e.name, "", e);
}
testList.SelectedRowIndex = testSelection;
testList.SetPosition(10, 30);
testList.SetSize(170, 180);
//glui.add_separator();
Base SettingsBox = new Base(glui);
SettingsBox.SetSize(200, 185);
SettingsBox.SetPosition(0, 250);
{
NumericUpDown spinner = new NumericUpDown(SettingsBox);
spinner.Text = "Vel Iters";
spinner.Min = 1;
spinner.Max = 500;
spinner.ValueChanged += delegate(Base sender, EventArgs vcargs) {
settings.velocityIterations = (int)spinner.Value;
};
spinner.Value = settings.velocityIterations;
spinner.SetPosition(10, 10);
NumericUpDown posSpinner = new NumericUpDown(SettingsBox);
posSpinner.Min = 0;
posSpinner.Max = 100;
posSpinner.Text = "Pos Iters";
posSpinner.ValueChanged += delegate(Base sender, EventArgs psargs) {
settings.positionIterations = (int)posSpinner.Value;
};
posSpinner.Value = settings.positionIterations;
posSpinner.SetPosition(10, 35);
NumericUpDown hertzSpinner = new NumericUpDown(SettingsBox);
hertzSpinner.Text = "Hertz";
hertzSpinner.Min = 5;
hertzSpinner.Max = 200;
hertzSpinner.ValueChanged += delegate(Base sender, EventArgs hargs) {
settingsHz = hertzSpinner.Value;
};
hertzSpinner.Value = settingsHz;
hertzSpinner.SetPosition(10, 60);
LabeledCheckBox scb = new LabeledCheckBox(SettingsBox);
scb.Text = "Sleep";
scb.CheckChanged += delegate(Base sender, EventArgs argsscb) {
settings.enableSleep = scb.IsChecked;
};
scb.IsChecked = settings.enableSleep;
scb.SetPosition(10, 85);
LabeledCheckBox wsu = new LabeledCheckBox(SettingsBox);
wsu.Text = "Warm Starting";
wsu.CheckChanged += delegate(Base sender, EventArgs argsscb) {
settings.enableWarmStarting = wsu.IsChecked;
};
wsu.IsChecked = settings.enableWarmStarting;
wsu.SetPosition(10, 110);
LabeledCheckBox toi = new LabeledCheckBox(SettingsBox);
toi.Text = "Time of Impact";
toi.CheckChanged += delegate(Base sender, EventArgs argsscb) {
settings.enableContinuous = toi.IsChecked;
};
toi.IsChecked = settings.enableContinuous;
toi.SetPosition(10, 135);
//.........这里部分代码省略.........