本文整理汇总了C#中System.Windows.Forms.Control.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# Control.Hide方法的具体用法?C# Control.Hide怎么用?C# Control.Hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.Hide方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: hideControl
private void hideControl(Control ctrl, int time)
{
var T = new Timer();
T.Interval = time * 1000;
T.Tick += delegate { ctrl.Hide(); T.Stop(); };
T.Start();
}
示例2: AddPopupPanel
public void AddPopupPanel(Control _TargetControl, Control _PopupControl, PopupEvent _PStyle, int _width, int _height)
{
PopupContent popup = new PopupContent();
popup.TargetControl = _TargetControl;
popup.PopupControl = _PopupControl;
popup.PType = PopupType.Panel;
popup.PStyle = _PStyle;
popup.WStyle = WindowStyle.Default;
popup.Width = _width;
popup.Height = _height;
popup.IsMCHide = true;
popup.WindowTitle = "";
_PopupControl.Tag = this;
if (popup.PStyle == PopupEvent.Click)
{
_TargetControl.Click += new EventHandler(_TargetControl_Click);
}
else if (popup.PStyle == PopupEvent.Mouse)
{
_TargetControl.MouseEnter += new EventHandler(_TargetControl_MouseEnter);
_TargetControl.MouseLeave += new EventHandler(_TargetControl_MouseLeave);
}
else
{
}
popupList.Add(popup);
_PopupControl.Hide();
}
示例3: Hide
public static void Hide(Control control)
{
if (control.InvokeRequired)
control.Invoke(new ShowHideDelegate(Hide), control);
else
control.Hide();
}
示例4: hider
private static void hider(Control frm)
{
frm.BeginInvoke((MethodInvoker)delegate
{
frm.Hide();
load.Hide();
});
}
示例5: random1
/// <summary>
/// Show or Hide control
/// </summary>
/// <param name="control1"></param>
public void random1(Control control1)
{
if (brandom1==true)
{
control1.Show();
brandom1 = false;
}
else
{
control1.Hide();
brandom1 = true;
}
}
示例6: SafeHide
/// <summary>
/// Hides a control
/// </summary>
/// <param name="container">The control to hide</param>
/// <param name="val">True to hide, false to show</param>
public static void SafeHide(Control container, bool val)
{
if (container.InvokeRequired)
{
SafeHideCallback d = SafeHide;
try
{
container.Invoke(d, new object[] { container, val });
}
catch (Exception) { }
}
else
{
if (val)
container.Hide();
else
container.Show();
}
}
示例7: changeControlShow
private void changeControlShow(Control control, bool show)
{
if (control.InvokeRequired)
{
control.Invoke(controlChange, control, show);
}
else
{
if (show) control.Show();
else control.Hide();
}
}
示例8: OpenTKGLContext
public OpenTKGLContext( Control control, Control parent )
{
// replaces form's (parent) picturebox (control) by glControl
this.glControl = new GLControl();
this.glControl.VSync = false;
this.glControl.Dock = control.Dock;
this.glControl.BackColor = control.BackColor;
this.glControl.Location = control.Location;
this.glControl.Name = control.Name;
this.glControl.Size = control.Size;
this.glControl.TabIndex = control.TabIndex;
this.glControl.Show();
int count = 0;
while ( this.glControl.Context == null && ++count < 10 )
{
System.Threading.Thread.Sleep( 10 );
}
if ( this.glControl.Context == null )
{
throw new Exception( "glControl.Context == null" );
}
var form = (Form)parent;
form.Controls.Add( this.glControl );
control.Hide();
if (
ResourceGroupManager.Instance.FindResourceFileInfo( ResourceGroupManager.DefaultResourceGroupName, "AxiomIcon.ico" )
.Count > 0 )
{
using ( System.IO.Stream icon = ResourceGroupManager.Instance.OpenResource( "AxiomIcon.ico" ) )
{
if ( icon != null )
{
form.Icon = new System.Drawing.Icon( icon );
}
}
}
Initialized = true;
}
示例9: 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");
//.........这里部分代码省略.........
示例10: HandleShowingTabPage
protected virtual void HandleShowingTabPage(TabPage page, Control c)
{
// First time this page has been displayed?
if (!page.Shown)
{
// Special testing needed for Forms
Form f = c as Form;
// AutoScaling can cause the Control/Form to be
if ((f != null) && (f.AutoScale))
{
// Workaround the problem where a form has a defined 'AutoScaleBaseSize' value. The
// first time it is shown it calculates the size of each contained control and scales
// as needed. But if the contained control is Dock=DockStyle.Fill it scales up/down so
// its not actually filling the space! Get around by hiding and showing to force correct
// calculation.
c.Show();
c.Hide();
}
// Only need extra logic first time around
page.Shown = true;
}
// Finally, show it!
c.Show();
// Restore focus to last know control to have it
if (page.StartFocus != null)
page.StartFocus.Focus();
else
c.Focus();
}
示例11: ZamienMiejscami
private void ZamienMiejscami(Control first, Control second)
{
if (first.Visible)
{
first.Hide();
second.Show();
second.Location = first.Location;
}
else
{
second.Hide();
first.Show();
first.Location = second.Location;
}
}
示例12: showComponent
void showComponent(Control c, bool show = false)
{
if (show == false)
{
c.Hide();
}
else
{
c.Show();
}
}
示例13: HandleTransitionCompleted
private void HandleTransitionCompleted(object sender, TransitionCompletedEventArgs<StateID, EventID, EventArgs> e)
{
if (e.Error != null)
{
MessageBox.Show(e.Error.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return;
}
switch (e.TargetStateID)
{
case StateID.Off:
currentPictureBox.Hide();
offPictureBox.Show();
currentPictureBox = offPictureBox;
currentUmlPictureBox.Hide();
umlOffPictureBox.Show();
currentUmlPictureBox = umlOffPictureBox;
break;
case StateID.Red:
currentPictureBox.Hide();
redPictureBox.Show();
currentPictureBox = redPictureBox;
currentUmlPictureBox.Hide();
umlRedPictureBox.Show();
currentUmlPictureBox = umlRedPictureBox;
break;
case StateID.Yellow:
currentPictureBox.Hide();
yellowPictureBox.Show();
currentPictureBox = yellowPictureBox;
currentUmlPictureBox.Hide();
umlYellowPictureBox.Show();
currentUmlPictureBox = umlYellowPictureBox;
break;
case StateID.Green:
currentPictureBox.Hide();
greenPictureBox.Show();
currentPictureBox = greenPictureBox;
currentUmlPictureBox.Hide();
umlGreenPictureBox.Show();
currentUmlPictureBox = umlGreenPictureBox;
break;
}
}