本文整理汇总了C#中Eto.Forms.Control类的典型用法代码示例。如果您正苦于以下问题:C# Control类的具体用法?C# Control怎么用?C# Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Control类属于Eto.Forms命名空间,在下文中一共展示了Control类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Remove
public override void Remove(Control child)
{
if (ReferenceEquals(Content, child))
{
Content = null;
}
}
示例2: RemoveItemsIndividuallyShouldClearParent
public void RemoveItemsIndividuallyShouldClearParent()
{
TestUtils.Invoke(() =>
{
var stackLayout = new StackLayout();
var items = new Control[] { new Label(), new Button(), new TextBox() };
foreach (var item in items)
stackLayout.Items.Add(item);
CollectionAssert.AreEqual(items, stackLayout.Children, "#1. Items do not match");
foreach (var item in items)
Assert.AreEqual(stackLayout, item.Parent, "#2. Items should have parent set to stack layout");
stackLayout.Items.RemoveAt(0);
Assert.IsNull(items[0].Parent, "#3. Item should have parent cleared when removed from stack layout");
stackLayout.Items[0] = new Button();
Assert.IsNull(items[1].Parent, "#4. Item should have parent cleared when replaced with another item in the stack layout");
Assert.AreEqual(stackLayout, items[2].Parent, "#5. Item should not have changed parent as it is still in the stack layout");
});
}
示例3: SetLocation
public static void SetLocation(Control control, Point value)
{
control.Properties[LocationProperty] = value;
var layout = control.Parent as PixelLayout;
if (layout != null)
layout.Move(control, value);
}
示例4: AddDockedControl
public static Container AddDockedControl (this Panel container, Control control, Padding? padding = null)
{
container.Content = control;
if (padding != null)
container.Padding = padding.Value;
return container;
}
示例5: SetLocation
public static void SetLocation (Control control, Point value)
{
control.Properties.Set (LocationProperty, value);
var layout = control.ParentLayout as TableLayout;
if (layout != null)
layout.Move (control, value);
}
示例6: FinishProcessing
void FinishProcessing(Control child, Exception error)
{
errorPanel.Visible = error != null;
if (error != null)
errorPanel.Content = new Label { Text = error.Message, ToolTip = error.ToString() };
if (child != null)
{
var window = child as Eto.Forms.Window;
if (window != null)
{
// swap out window for a panel so we can add it as a child
var content = window.Content;
window.Content = null;
child = new Panel { Content = content, Padding = window.Padding };
}
previewPanel.Content = child;
}
if (processingCount > 1)
{
// process was requested while we were processing the last one, so redo
processingCount = 1;
timer.Start();
}
else
processingCount = 0;
}
示例7: PreviewEditorView
public PreviewEditorView(Control editor, Func<string> getCode)
{
Editor = editor;
this.getCode = getCode;
Orientation = Orientation.Vertical;
FixedPanel = SplitterFixedPanel.None;
RelativePosition = 0.4;
previewPanel = new Panel();
errorPanel = new Panel { Padding = new Padding(5), Visible = false, BackgroundColor = new Color(Colors.Red, .4f) };
Panel1 = new StackLayout
{
HorizontalContentAlignment = HorizontalAlignment.Stretch,
Items =
{
new StackLayoutItem(previewPanel, expand: true),
errorPanel
}
};
Panel2 = editor;
timer = new UITimer { Interval = RefreshTime };
timer.Elapsed += Timer_Elapsed;
}
示例8: ControlEventsShouldBeHandled
public void ControlEventsShouldBeHandled(Control control)
{
TestBase.Invoke(() =>
{
try
{
control.SizeChanged += Control_EventHandler;
control.EnabledChanged += Control_EventHandler;
control.GotFocus += Control_EventHandler;
control.LostFocus += Control_EventHandler;
control.KeyDown += Control_EventHandler;
control.KeyUp += Control_EventHandler;
control.MouseUp += Control_EventHandler;
control.MouseDown += Control_EventHandler;
control.MouseEnter += Control_EventHandler;
control.MouseLeave += Control_EventHandler;
control.MouseDoubleClick += Control_EventHandler;
control.MouseWheel += Control_EventHandler;
//control.Shown += Control_EventHandler;
//control.TextInput += Control_EventHandler;
}
catch (Exception ex)
{
throw new InvalidOperationException($"Control {control.GetType().Name}:", ex);
}
});
}
示例9: LogEvents
protected override void LogEvents(Control control)
{
base.LogEvents(control);
control.MouseDoubleClick += delegate(object sender, MouseEventArgs e)
{
LogMouseEvent(control, "MouseDoubleClick", e);
};
control.MouseWheel += delegate(object sender, MouseEventArgs e)
{
LogMouseEvent(control, "MouseWheel", e);
};
control.MouseMove += delegate(object sender, MouseEventArgs e)
{
LogMouseEvent(control, "MouseMove", e);
};
control.MouseUp += delegate(object sender, MouseEventArgs e)
{
LogMouseEvent(control, "MouseUp", e);
};
control.MouseDown += delegate(object sender, MouseEventArgs e)
{
LogMouseEvent(control, "MouseDown", e);
};
control.MouseEnter += delegate(object sender, MouseEventArgs e)
{
LogMouseEvent(control, "MouseEnter", e);
};
control.MouseLeave += delegate(object sender, MouseEventArgs e)
{
LogMouseEvent(control, "MouseLeave", e);
};
}
示例10: GetContent
public static Control GetContent(Control content)
{
var window = content as Window;
if (window != null)
{
var size = window.ClientSize;
// some platforms report 0,0 even though it probably should be -1, -1 initially.
if (size.Width == 0)
size.Width = -1;
if (size.Height == 0)
size.Height = -1;
// swap out window for a panel so we can add it as a child
content = new Panel
{
BackgroundColor = SystemColors.Control,
Padding = window.Padding,
Size = size,
Content = window.Content
};
}
else
{
content = new Panel
{
BackgroundColor = SystemColors.Control,
Content = content
};
}
return content;
}
示例11: Show
/// <summary>
/// Show the context menu relative to the specified control
/// </summary>
/// <param name="relativeTo">Control to show the menu relative to</param>
public void Show(Control relativeTo)
{
if (Trim)
Items.Trim();
OnPreLoad(EventArgs.Empty);
OnLoad(EventArgs.Empty);
Handler.Show(relativeTo);
}
示例12: Show
public static DialogResult Show (Generator g, Control parent, string text, string caption, MessageBoxButtons buttons, MessageBoxType type = MessageBoxType.Information)
{
var mb = g.CreateControl<IMessageBox> ();
mb.Text = text;
mb.Caption = caption;
mb.Type = type;
return mb.ShowDialog (parent, buttons);
}
示例13: AutoSized
public static Control AutoSized (Control control, Padding? padding = null)
{
var layout = new TableLayout(new Panel(), 2, 2);
layout.Padding = padding ?? Padding.Empty;
layout.Spacing = Size.Empty;
layout.Add (control, 0, 0);
return layout.Container;
}
示例14: LogEvents
protected override void LogEvents (Control control)
{
base.LogEvents (control);
control.KeyDown += delegate(object sender, KeyPressEventArgs e) {
Log.Write (control, "KeyDown, Key: {0}, Char: {1}", e.KeyData, e.KeyChar);
};
}
示例15: LogEvents
protected override void LogEvents(Control control)
{
base.LogEvents(control);
control.KeyDown += control_KeyDown;
control.KeyUp += control_KeyUp;
}