• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Forms.Control类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Eto.Forms.Control的典型用法代码示例。如果您正苦于以下问题:C# Control类的具体用法?C# Control怎么用?C# Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Control类属于Eto.Forms命名空间,在下文中一共展示了Control类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Remove

		public override void Remove(Control child)
		{
			if (ReferenceEquals(Content, child))
			{
				Content = null;
			}
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:7,代码来源:Panel.cs


示例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");
			});
		}
开发者ID:mhusen,项目名称:Eto,代码行数:25,代码来源:StackLayoutTests.cs


示例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);
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:7,代码来源:PixelLayout.cs


示例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;
		}
开发者ID:Exe0,项目名称:Eto,代码行数:7,代码来源:DockLayout.cs


示例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);
		}
开发者ID:carlokok,项目名称:Eto,代码行数:7,代码来源:PixelLayout.cs


示例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;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:27,代码来源:PreviewEditorView.cs


示例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;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:26,代码来源:PreviewEditorView.cs


示例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);
				}
			});
		}
开发者ID:picoe,项目名称:Eto,代码行数:27,代码来源:ControlEventTests.cs


示例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);
			};
		}
开发者ID:mhusen,项目名称:Eto,代码行数:33,代码来源:MouseEventsSection.cs


示例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;
		}
开发者ID:picoe,项目名称:Eto,代码行数:30,代码来源:DesignPanel.cs


示例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);
		}
开发者ID:mhusen,项目名称:Eto,代码行数:12,代码来源:ContextMenu.cs


示例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);
		}
开发者ID:hultqvist,项目名称:Eto,代码行数:8,代码来源:MessageBox.cs


示例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;
		}
开发者ID:carlokok,项目名称:Eto,代码行数:8,代码来源:TableLayout.cs


示例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);
			};
		}
开发者ID:hultqvist,项目名称:Eto,代码行数:8,代码来源:KeyEventsSection.cs


示例15: LogEvents

		protected override void LogEvents(Control control)
		{
			base.LogEvents(control);

			control.KeyDown += control_KeyDown;

			control.KeyUp += control_KeyUp;
		}
开发者ID:Exe0,项目名称:Eto,代码行数:8,代码来源:KeyEventsSection.cs


示例16: Add

		public void Add(Control control, int x, int y)
		{
			control.Properties[LocationProperty] = new Point(x, y);
			controls.Add(control);
			var load = SetParent(control);
			Handler.Add(control, x, y);
			if (load)
				control.OnLoadComplete(EventArgs.Empty);
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:9,代码来源:PixelLayout.cs


示例17: AddDockedControl

		public static Container AddDockedControl (this Container container, Control control, Padding? padding = null)
		{
			var layout = container.Layout as DockLayout;
			if (layout == null)
				layout = new DockLayout (container);
			if (padding != null)
				layout.Padding = padding.Value;
			layout.Content = control;
			return container;
		}
开发者ID:majorsilence,项目名称:Eto,代码行数:10,代码来源:DockLayout.cs


示例18: ShowDialog

		public DialogResult ShowDialog (Control parent, PrintDocument document)
		{
			this.PrintSettings.MaximumPageRange = new Range (1, document.PageCount);
			this.PrintSettings = document.PrintSettings;
			var result = this.ShowDialog (parent);
			if (result == DialogResult.Ok) {
				document.Print ();
			}
			return result;
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:10,代码来源:PrintDialog.cs


示例19: KeyUp

		public static bool KeyUp(Control control, NSEvent theEvent)
		{
			if (control != null)
			{
				var kpea = theEvent.ToEtoKeyEventArgs();
				control.OnKeyUp(kpea);
				return kpea.Handled;
			}
			return false;
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:10,代码来源:MacEventView.cs


示例20: LogEvents

		protected override void LogEvents (Control control)
		{
			base.LogEvents (control);
			
			control.GotFocus += delegate {
				Log.Write (control, "GotFocus");
			};
			control.LostFocus += delegate {
				Log.Write (control, "LostFocus");
			};
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:11,代码来源:FocusEventsSection.cs



注:本文中的Eto.Forms.Control类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DynamicLayout类代码示例发布时间:2022-05-24
下一篇:
C# Forms.CheckBox类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap