本文整理汇总了C#中System.Windows.Forms.Control.BringToFront方法的典型用法代码示例。如果您正苦于以下问题:C# Control.BringToFront方法的具体用法?C# Control.BringToFront怎么用?C# Control.BringToFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.BringToFront方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSleepingDetailsPanel
public void AddSleepingDetailsPanel(Control c)
{
this.panelWizardSteps.Controls.Add(c);
c.Dock = DockStyle.Fill;
c.BringToFront();
c.Visible = false;
}
示例2: GetImage
public static Image GetImage(Control c_)
{
Graphics g = null;
Image ret = null;
try
{
if (c_ is Form)
c_.BringToFront();
else
c_.FindForm().BringToFront();
Application.DoEvents();
g = c_.CreateGraphics();
ret = new Bitmap(c_.ClientRectangle.Width, c_.ClientRectangle.Height, g);
Graphics g2 = Graphics.FromImage(ret);
IntPtr dc1 = g.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0, c_.ClientRectangle.Width, c_.ClientRectangle.Height, dc1, 0, 0, 13369376);
g.ReleaseHdc(dc1);
g2.ReleaseHdc(dc2);
}
finally
{
if (g != null)
g.Dispose();
}
return ret;
}
示例3: Clear
public void Clear()
{
_childControl = new Panel();
_childControl.Parent = this;
_childControl.Dock = DockStyle.Fill;
_childControl.BringToFront();
}
示例4: BeginDrag
private static bool m_IsSimpleDrag = false; // Is this a simple drag?
#endregion Fields
#region Methods
/// <summary>
/// Returns the DataObject needed for a DoDragDrop, from a specified Control
/// Used with controls that implement IDragDropEnabled (recommended usage)
/// </summary>
/// <param name="_ctrl">Control to get DataObject for</param>
/// <param name="_invalidate">Invalidate the control or not?
/// (Set to true if you need to change the appearance of the control during a DragDrop)</param>
/// <returns>Control converted to a DataObject ready for dragging</returns>
public static DataObject BeginDrag(Control _ctrl, bool _invalidate)
{
// If not initialized then throw an Exception
if (!m_Initialized)
throw new Exception(string.Format("{0} not initialized.",
"EIBFormDesigner.Event.DragDropHandler"), null);
// If this is not a valid control to be dragged, throw an exception
if (!(_ctrl is IDragDropEnabled))
throw new ControlInterfaceException(
string.Format("[{0}] only accepts controls that implement\n[{1}] for drag operations.\n\nUse {2} instead.",
"EIBFormDesigner.Event",
"IDragDropEnabled",
"BeginSimpleDrag"));
DataObject doControlToDrag = StoreControl(_ctrl, false);
// Inform the control that it has begun a drag operation
((IDragDropEnabled)_ctrl).StoreLocation();
((IDragDropEnabled)_ctrl).IsDragging = true;
// Set the control up to be in the foreground and invalidate it
// incase it needs redrawing
if (_invalidate)
{
_ctrl.BringToFront();
_ctrl.Invalidate();
}
// return the converted control as a DataObject
return doControlToDrag;
}
示例5: DispayControl
public void DispayControl(Control childControl)
{
childControl.Parent = this;
childControl.Dock = DockStyle.Fill;
_childControl = childControl;
_childControl.BringToFront();
}
示例6: Init
/// <summary>
/// Init for basic panebar.
/// </summary>
/// <param name="mediator"></param>
/// <param name="mainControl"></param>
public void Init(Mediator mediator, Control mainControl)
{
m_mediator = mediator;
m_paneBar = CreatePaneBar();
Controls.Add(m_paneBar as Control);
mainControl.Dock = DockStyle.Fill;
Controls.Add(mainControl);
mainControl.BringToFront();
}
示例7: CargarControl
public void CargarControl(Control oControl)
{
if (!this.panelContenedor.Controls.Contains(oControl))
{
oControl.Dock = DockStyle.Fill;
this.panelContenedor.Controls.Add(oControl);
}
this.panelContenedor.Tag = oControl;
oControl.BringToFront();
oControl.Show();
}
示例8: Show
public static Control Show(Control parent) {
Control o = new Control();
o.Location = Point.Empty;
o.Size = parent.ClientSize;
o.Parent = parent;
o.BackgroundImage = Resources.ExpirationHS;
o.BackgroundImageLayout = ImageLayout.Center;
o.BackColor = Color.WhiteSmoke;
o.Show();
o.BringToFront();
return o;
}
示例9: LoadControlToView
/// <summary>
/// Dynamically adds a control to the Mainform
/// </summary>
/// <param name="controlInstance"></param>
/// <param name="layoutPanelName"></param>
private void LoadControlToView(Control controlInstance, int tableLayoutPosition)
{
if (!this.Controls.Contains(controlInstance))
{
//this.Visible = false;
((TableLayoutPanel)this.Controls["tableLayoutPanel1"]).Controls.Add(controlInstance, tableLayoutPosition, 0);
controlInstance.Dock = DockStyle.Fill;
controlInstance.BringToFront();
}
else
{
QAControl.Instance.BringToFront();
}
}
示例10: AddCollapsibleControlFor
public CollapsibleControl AddCollapsibleControlFor(Control control, int expandedHeight = 50, string label = "Collapsible Control")
{
if (expandedHeight == -1)
{
expandedHeight = control.Height;
}
CollapsibleControl newControl = AddCollapsibleControl(expandedHeight);
newControl.SuspendLayout();
newControl.Label = label;
newControl.Controls.Add(control);
control.Dock = DockStyle.Fill;
control.BringToFront();
int m = 3;
newControl.ResumeLayout();
return newControl;
}
示例11: ExplorerBarItem
/// ------------------------------------------------------------------------------------
/// <summary>
/// Construct an SimpleExplorerBar
/// </summary>
/// ------------------------------------------------------------------------------------
public ExplorerBarItem(string text, Control hostedControl)
{
m_button = new Button();
m_button.Text = text;
m_button.Dock = DockStyle.Top;
m_button.Height = 13 + m_button.Font.Height;
m_button.Cursor = Cursors.Hand;
m_button.Click += m_button_Click;
m_button.Paint += m_button_Paint;
m_button.MouseEnter += m_button_MouseEnter;
m_button.MouseLeave += m_button_MouseLeave;
Controls.Add(m_button);
m_control = hostedControl;
SetHostedControlHeight(m_control.Height);
m_control.Dock = DockStyle.Fill;
Controls.Add(m_control);
m_control.BringToFront();
// Make the expand/collapse glyph width the height of
// one line of button text plus the fudge factor.
m_glyphButtonWidth = 13 + Font.Height;
}
示例12: render
private async void render(Control c, int y)
{
if (!thumbs.ContainsKey(c.Name))
{
await Task.Delay(100);
render(c, y);
return;
}
Controls.Find("console", true)[0].Text += "\n[ -> ] rendering " + c.Name;
c.Visible = true;
((FancyLabel)c).Image = thumbs[c.Name];
c.BringToFront();
c.Size = new Size(100, 100);
if (!((FancyLabel)c).Text.Equals(""))
{
((FancyLabel)c).ImageAlign = ContentAlignment.TopCenter;
}
}
示例13: TestPublicMethods
public void TestPublicMethods ()
{
// Public Methods that force Handle creation:
// - CreateControl ()
// - CreateGraphics ()
// - GetChildAtPoint ()
// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
// - PointToClient ()
// - PointToScreen ()
// - RectangleToClient ()
// - RectangleToScreen ()
Control c = new Control ();
c.BringToFront ();
Assert.IsFalse (c.IsHandleCreated, "A1");
c.Contains (new Control ());
Assert.IsFalse (c.IsHandleCreated, "A2");
c.CreateControl ();
Assert.IsTrue (c.IsHandleCreated, "A3");
c = new Control ();
Graphics g = c.CreateGraphics ();
g.Dispose ();
Assert.IsTrue (c.IsHandleCreated, "A4");
c = new Control ();
c.Dispose ();
Assert.IsFalse (c.IsHandleCreated, "A5");
c = new Control ();
//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
//Assert.IsFalse (c.IsHandleCreated, "A6");
//Assert.AreEqual (DragDropEffects.None, d, "A6b");
//Bitmap b = new Bitmap (100, 100);
//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
//Assert.IsFalse (c.IsHandleCreated, "A7");
//b.Dispose ();
c.FindForm ();
Assert.IsFalse (c.IsHandleCreated, "A8");
c.Focus ();
Assert.IsFalse (c.IsHandleCreated, "A9");
c.GetChildAtPoint (new Point (10, 10));
Assert.IsTrue (c.IsHandleCreated, "A10");
c.GetContainerControl ();
c = new Control ();
Assert.IsFalse (c.IsHandleCreated, "A11");
c.GetNextControl (new Control (), true);
Assert.IsFalse (c.IsHandleCreated, "A12");
#if NET_2_0
c.GetPreferredSize (Size.Empty);
Assert.IsFalse (c.IsHandleCreated, "A13");
#endif
c.Hide ();
Assert.IsFalse (c.IsHandleCreated, "A14");
c.Invalidate ();
Assert.IsFalse (c.IsHandleCreated, "A15");
//c.Invoke (new InvokeDelegate (InvokeMethod));
//Assert.IsFalse (c.IsHandleCreated, "A16");
c.PerformLayout ();
Assert.IsFalse (c.IsHandleCreated, "A17");
c.PointToClient (new Point (100, 100));
Assert.IsTrue (c.IsHandleCreated, "A18");
c = new Control ();
c.PointToScreen (new Point (100, 100));
Assert.IsTrue (c.IsHandleCreated, "A19");
c = new Control ();
//c.PreProcessControlMessage ???
//c.PreProcessMessage ???
c.RectangleToClient (new Rectangle (0, 0, 100, 100));
Assert.IsTrue (c.IsHandleCreated, "A20");
c = new Control ();
c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
Assert.IsTrue (c.IsHandleCreated, "A21");
c = new Control ();
c.Refresh ();
Assert.IsFalse (c.IsHandleCreated, "A22");
c.ResetBackColor ();
Assert.IsFalse (c.IsHandleCreated, "A23");
c.ResetBindings ();
Assert.IsFalse (c.IsHandleCreated, "A24");
c.ResetCursor ();
Assert.IsFalse (c.IsHandleCreated, "A25");
c.ResetFont ();
Assert.IsFalse (c.IsHandleCreated, "A26");
c.ResetForeColor ();
Assert.IsFalse (c.IsHandleCreated, "A27");
c.ResetImeMode ();
Assert.IsFalse (c.IsHandleCreated, "A28");
c.ResetRightToLeft ();
Assert.IsFalse (c.IsHandleCreated, "A29");
c.ResetText ();
Assert.IsFalse (c.IsHandleCreated, "A30");
c.SuspendLayout ();
Assert.IsFalse (c.IsHandleCreated, "A31");
c.ResumeLayout ();
Assert.IsFalse (c.IsHandleCreated, "A32");
#if NET_2_0
c.Scale (new SizeF (1.5f, 1.5f));
Assert.IsFalse (c.IsHandleCreated, "A33");
#endif
c.Select ();
Assert.IsFalse (c.IsHandleCreated, "A34");
//.........这里部分代码省略.........
示例14: ResetControl
private void ResetControl(SplitterPanel panel, Control newControl)
{
panel.SuspendLayout();
if (!panel.Controls.Contains(newControl))
panel.Controls.Add(newControl);
newControl.BringToFront();
if (Panel1 == panel)
m_firstFrontedControl = newControl;
else
m_secondFrontedControl = newControl;
panel.ResumeLayout();
}
示例15: ShowControl
protected virtual void ShowControl(Control editorControl)
{
editorControl.Show();
editorControl.BringToFront();
editorControl.Focus();
}