本文整理汇总了C#中System.Windows.Forms.Control.PerformLayout方法的典型用法代码示例。如果您正苦于以下问题:C# Control.PerformLayout方法的具体用法?C# Control.PerformLayout怎么用?C# Control.PerformLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.PerformLayout方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToContainer
// INTERFACE FUNCTIONS
public void AddToContainer(Control container)
{
container.SuspendLayout();
AddControlsToContainer(container);
container.ResumeLayout(false);
container.PerformLayout();
}
示例2: SingleLineFlowLayoutManager
public SingleLineFlowLayoutManager(Control container, int margin)
{
this.container = container;
this.margin = margin;
// Attach the event handler.
container.Layout += new LayoutEventHandler(UpdateLayout);
// Refresh the layout.
container.PerformLayout(container, "LayoutManager");
}
示例3: CallControlPerformLayout
public static void CallControlPerformLayout(Control c, object[] obj)
{
c.PerformLayout((Control)obj[0], (string)obj[1]);
}
示例4: LayoutTransaction
public LayoutTransaction(Control controlToLayout, IArrangedElement controlCausingLayout, string property, bool resumeLayout) {
CommonProperties.xClearPreferredSizeCache(controlCausingLayout);
_controlToLayout = controlToLayout;
_resumeLayout = resumeLayout;
if(_controlToLayout != null) {
#if DEBUG
_layoutSuspendCount = _controlToLayout.LayoutSuspendCount;
#endif
_controlToLayout.SuspendLayout();
CommonProperties.xClearPreferredSizeCache(_controlToLayout);
// Same effect as calling performLayout on Dispose but then we would have to keep
// controlCausingLayout and property around as state.
if (resumeLayout) {
_controlToLayout.PerformLayout(new LayoutEventArgs(controlCausingLayout, property));
}
}
}
示例5: 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");
//.........这里部分代码省略.........
示例6: ReplaceTextBox
public static HotKeyControlEx ReplaceTextBox(Control cContainer, TextBox tb,
bool bNoRightModKeys)
{
Debug.Assert(tb != null); if(tb == null) throw new ArgumentNullException("tb");
tb.Enabled = false;
tb.Visible = false;
cContainer.Controls.Remove(tb);
HotKeyControlEx hk = new HotKeyControlEx();
hk.Location = tb.Location;
hk.Size = tb.Size;
hk.NoRightModKeys = bNoRightModKeys;
cContainer.Controls.Add(hk);
cContainer.PerformLayout();
return hk;
}
示例7: SetFlowSize
private void SetFlowSize(Control c, FlowLayoutPanel flow)
{
c.Width = flow.Width - 1 - c.Margin.Left - c.Margin.Right - (flow.VerticalScroll.Visible ? SystemInformation.VerticalScrollBarWidth : 0);
c.PerformLayout();
}
示例8: SelectViewer
private void SelectViewer(Control viewer)
{
if (viewer == _currentViewer)
return;
if (_currentViewer != null)
_currentViewer.SuspendLayout();
viewer.ResumeLayout();
viewer.PerformLayout();
viewer.BringToFront();
_currentViewer = viewer;
}
示例9: SwitchLocalization
/// <summary>
/// Tries to switch to the specified language, returning false on failure.
/// </summary>
/// <param name="control">The control to localize.</param>
/// <param name="cultureCode">The culture code to set - for example, en-US or de-DE.</param>
/// <returns>Whether the localization was actually switched.</returns>
/// <exception cref="ArgumentNullException"><paramref name="control"/> is <c>null</c>.</exception>
public static bool SwitchLocalization(Control control, string cultureCode)
{
if (control == null)
{
throw new ArgumentNullException("control");
}
ComponentResourceManager resources = new ComponentResourceManager(control.GetType());
if (LocalizationHelper.SetCulture(resources, cultureCode))
{
LocalizationHelper.ApplyResources(resources, control);
control.PerformLayout();
return true;
}
return false;
}