当前位置: 首页>>代码示例>>C#>>正文


C# Forms.Control类代码示例

本文整理汇总了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;
			}
		}
开发者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


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