本文整理汇总了C#中System.Windows.Forms.Control.SuspendLayout方法的典型用法代码示例。如果您正苦于以下问题:C# Control.SuspendLayout方法的具体用法?C# Control.SuspendLayout怎么用?C# Control.SuspendLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.SuspendLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearChilds
//-------------------------------------------------------------------------------------
/// <summary>
/// Рекурсивно очищает дочерние контролы с вызовом Parent == null
/// </summary>
/// <param name="ctrl"></param>
public static void ClearChilds(Control ctrl)
{
try
{
ctrl.SuspendLayout();
Stack<Control> st = new Stack<Control>();
foreach(Control c in ctrl.Controls)
st.Push(c);
while(st.Count > 0)
{
Control c = st.Pop();
c.Parent = null;
if(c.Controls.Count > 0)
{
foreach(Control cc in c.Controls)
st.Push(cc);
}
c.Controls.Clear();
}
}
finally
{
ctrl.ResumeLayout();
}
}
示例2: AddToContainer
// INTERFACE FUNCTIONS
public void AddToContainer(Control container)
{
container.SuspendLayout();
AddControlsToContainer(container);
container.ResumeLayout(false);
container.PerformLayout();
}
示例3: SuspendLayout
public static void SuspendLayout(Control control, Action action)
{
control.SuspendLayout();
try
{
action();
}
finally
{
control.ResumeLayout();
}
}
示例4: CreateLayout
public int CreateLayout(string LayoutFileName, Control rootPanel)
{
int height = 0;
List<Control> controlList = new List<Control>();
XmlReaderSettings settings = new XmlReaderSettings {
IgnoreComments = true,
IgnoreWhitespace = true
};
XmlReader xReader = null;
try
{
xReader = XmlReader.Create(LayoutFileName, settings);
rootPanel.SuspendLayout();
bool flag = false;
while (xReader.Read())
{
if ((xReader.NodeType == XmlNodeType.Element) & (xReader.LocalName == "layout"))
{
flag = true;
if (xReader.GetAttribute("UseDefaultSize") == "True")
{
Size size = new Size(xReader.GetAttribute("Size"));
height = size.Height;
}
}
else if (flag)
{
this.doCreateLayout(xReader, controlList);
}
}
}
catch (XmlException exception)
{
NaccsException exception2 = new NaccsException(MessageKind.Error, 0x1f8, exception.Message);
throw exception2;
}
catch (Exception exception3)
{
NaccsException exception4 = new NaccsException(MessageKind.Error, 510, exception3.Message);
throw exception4;
}
finally
{
rootPanel.Controls.AddRange(controlList.ToArray());
rootPanel.ResumeLayout(true);
if (xReader != null)
{
xReader.Close();
}
}
return height;
}
示例5: InitBorderTitle
public static void InitBorderTitle(this Control ctrl, Window window, Control child)
{
if (window is ActiveWindow)
{
ActiveWindow wnd = (ActiveWindow)window;
if (ctrl.Controls.ContainsKey("LabelTitle")) ctrl.Controls.RemoveByKey("LabelTitle");
if (wnd.BorderVisible)
{
ctrl.SuspendLayout();
child.SuspendLayout();
child.Left += wnd.BorderWidth;
child.Width -= wnd.BorderWidth << 1;
child.Height -= wnd.BorderWidth;
System.Windows.Forms.Label title = new System.Windows.Forms.Label();
title.AutoSize = false;
title.Name = "LabelTitle";
title.BackColor = wnd.BorderColorFrienly;
title.Font = new Font(wnd.TitleFont, wnd.TitleSize);
title.ForeColor = wnd.TitleColorFrienly;
title.Text = wnd.TitleText;
title.Left = wnd.BorderWidth;
title.Top = 0;
using (Graphics g = title.CreateGraphics())
{
title.Size = g.MeasureString(wnd.TitleText, title.Font).ToSize();
}
title.Width = child.Width;
title.AutoEllipsis = true;
title.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ctrl.Controls.Add(title);
if (title.Height == 0)
{
child.Top += wnd.BorderWidth;
child.Height -= wnd.BorderWidth;
}
else
{
child.Top += title.Height;
child.Height -= title.Height;
}
ctrl.BackColor = wnd.BorderColorFrienly;
child.ResumeLayout();
ctrl.ResumeLayout();
title.Invalidate();
}
ctrl.Text = wnd.TitleText;
}
}
示例6: Sinalizar
public static void Sinalizar(Control hospedeiro)
{
SinalizaçãoAcertado sinalização = new SinalizaçãoAcertado();
sinalização.Location = new Point((hospedeiro.ClientSize.Width - sinalização.Width) / 2, (hospedeiro.ClientSize.Height - sinalização.Height) / 2);
hospedeiro.SuspendLayout();
hospedeiro.Controls.Add(sinalização);
hospedeiro.Visible = true;
sinalização.BringToFront();
hospedeiro.ResumeLayout();
hospedeiro.Resize += new EventHandler(sinalização.Reposicionar);
}
示例7: PluginTabPage
public PluginTabPage(PluginInfo pluginInfo, Control plugin, PluginTabPage parentTab)
: base(pluginInfo.Name)
{
plugin.SuspendLayout();
plugin.Dock = DockStyle.Fill;
Info = pluginInfo;
Plugin = plugin;
FromTab = parentTab;
Controls.Add(plugin);
Name = pluginInfo.Name;
plugin.ResumeLayout();
}
示例8: ControlBatchOperationWrap
/// <summary>
/// 创建 <see cref="ControlBatchOperationWrap" /> 的新实例(ControlBatchOperationWrap)
/// </summary>
/// <param name="control"></param>
public ControlBatchOperationWrap(Control control)
{
if (control == null)
throw new ArgumentNullException("control");
Control = control;
control.SuspendLayout();
if (control is ListView)
(control as ListView).BeginUpdate();
else if (control is ListBox)
(control as ListBox).BeginUpdate();
else if (control is TreeView)
(control as TreeView).BeginUpdate();
}
示例9: TKWindow
public TKWindow(Size displayDimensions, GlyphPalette palette, Control context)
: base(displayDimensions, palette)
{
if (context == null)
{
form = new TKForm();
form.ClientSize = displayDimensions;
form.FormClosing += new FormClosingEventHandler(Form_FormClosing);
form.Show();
context = form;
}
context.SuspendLayout();
Control.Dock = DockStyle.Fill;
Control.BackColor = Color.Blue;
Control.VSync = false;
Control.Resize += new EventHandler(Control_Resize);
Control.Paint += new PaintEventHandler(Control_Paint);
Control.Location = new Point(0, 0);
Control.Size = context.ClientSize;
context.Controls.Add(Control);
context.ResumeLayout(false);
paletteId = GL.GenTexture();
Bitmap bmp = palette.SourceBitmap;
GL.BindTexture(TextureTarget.Texture2D, paletteId);
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, bmp_data.Width, bmp_data.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
bmp.UnlockBits(bmp_data);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
base.Resize += new EmptyDelegate(TKWindow_Resize);
this.WindowSize = Control.Size;
GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f);
GL.Disable(EnableCap.DepthTest);
GL.Disable(EnableCap.CullFace);
}
示例10: AddFilterControl
private void AddFilterControl(Control filterControl)
{
filterControl.SuspendLayout();
UserControl userControl = filterControl as UserControl;
if (userControl != null)
{
BasicFormLocalizer argument = SettingsManager.GetArgument<BasicFormLocalizer>(ArgumentKey.FormLocalizer);
if (argument != null)
{
argument.Localize(userControl);
}
}
filterControl.Margin = new Padding(0);
if (filterControl is IFilterControl)
{
this.InitializeFilterControl((IFilterControl) filterControl);
}
filterControl.ResumeLayout();
this.flpFilters.Controls.Add(filterControl);
this.flpFilters.Controls.SetChildIndex(this.tsNewCondition, this.flpFilters.Controls.Count);
this.tsNewCondition.TabIndex = this.flpFilters.Controls.Count - 1;
}
示例11: ResizeChilds
public static void ResizeChilds(Control c)
{
c.SuspendLayout();
ResizeChildsInt(c, true);
c.ResumeLayout();
}
示例12: DeserializeWindowXML
//Deserialize individual base windows and there child control
public static void DeserializeWindowXML(string fileName, Control baseFrame, XmlNode parentXMLNode)
{
DataSet dataset = new DataSet();
XmlDocument doc = new XmlDocument();
XmlNode currentXmlNode = null;
Dictionary<string, EIBNode> listNode = new Dictionary<string, EIBNode>();
try
{
// disabling re-drawing of treeview till all nodes are added
baseFrame.SuspendLayout();
fileName = fileName + ".xml";
if (parentXMLNode == null)
{
doc.Load(fileName);
currentXmlNode = doc.FirstChild;
}
else
{
currentXmlNode = parentXMLNode;
}
baseFrame.Controls.Clear();
if (currentXmlNode.Name == FormDesignerConstants.BaseWindow)
{
// loading node attributes
UpdateControlProperties(baseFrame, currentXmlNode);
}
//Iterate all nodes
foreach (XmlNode xmlNode in currentXmlNode.ChildNodes)
{
if (xmlNode.NodeType == XmlNodeType.Element)
{
if (xmlNode.Name == FormDesignerConstants.NodeControl)
{
EIBNode.counter++;
EIBNode eibNode = new EIBNode();
UpdateControlProperties(eibNode, xmlNode);
eibNode.nodeIdText.Text = xmlNode.Attributes["id"].Value.ToString();
eibNode.startNodeCheck.Checked = (xmlNode.Attributes["isstart"].Value.ToLower().Equals("true"));
// baseFrame.Controls.Add(eibNode);
listNode.Add(eibNode.nodeIdText.Text, eibNode);
//EIBNode newNode = new EIBNode();
// UpdateControlProperties(newNode, xmlNode);
// newNode.nodeIdText.Text = xmlNode["workflownode"].Attributes["id"].Value.ToString();
// newNode.startNodeCheck.Checked = (xmlNode["workflownode"].Attributes["isstart"].Value.ToLower().Equals("true"));
//XmlNode xmlWorkFlowNode = getXMLNodeWithName(xmlNode,"workflownode")
//xmlNode[
eibNode.WorkFlowNode= Desearializeworkflownodexml(xmlNode);
eibNode.workflowNode.WorkFlowNodeId = eibNode.nodeIdText.Text;
eibNode.nodeIdText.Enabled = false;
((BaseWindow)baseFrame.Parent).WorkflowNodes.Add(eibNode.workflowNode.WorkFlowNodeId, eibNode);
baseFrame.Controls.Add(eibNode);
}
if (xmlNode.Name == "connector")
{
try
{
//EIBNodeConnector.counter++;
EIBNodeConnector newNode = new EIBNodeConnector();
XmlNode xmlNodeconnector = xmlNode;
UpdateControlProperties(newNode, xmlNodeconnector);
XmlNode connectorNode = xmlNodeconnector;
//XmlNode fromNodeName = connectorNode["from"].Attributes["id"];
//XmlNode toNodeName = connectorNode["to"].Attributes["id"];
string fromNodeName = connectorNode["from"].Attributes["id"].Value;
string toNodeName = connectorNode["to"].Attributes["id"].Value;
EIBNode fromNode = listNode[fromNodeName];
EIBNode toNode = listNode[toNodeName];
Graphics g = null;
Bitmap bmpBack = new Bitmap(baseFrame.Width, baseFrame.Height);
Graphics.FromImage(bmpBack).Clear(baseFrame.BackColor);
baseFrame.BackgroundImage = (Bitmap)bmpBack.Clone();
g = Graphics.FromImage(baseFrame.BackgroundImage);
int centerMarkX = (fromNode.Center.X + toNode.Center.X) / 2;
int centerMarkY = (fromNode.Center.Y + toNode.Center.Y) / 2;
newNode.centerMark.Location = new Point(centerMarkX - 4, centerMarkY - 4);
newNode.InitiateSettings((EIBPanel)baseFrame);
newNode.Mark1 = fromNode;
newNode.Mark2 = toNode;
newNode.createLine();
baseFrame.Controls.Add(newNode.centerMark);
g.DrawLine(new Pen(Color.RoyalBlue, (float)2), fromNode.Center.X, fromNode.Center.Y, centerMarkX, centerMarkY);
g.DrawLine(new Pen(Color.RoyalBlue, (float)2), toNode.Center.X, toNode.Center.Y, centerMarkX, centerMarkY);
baseFrame.Controls.Add(newNode);
}
catch (Exception ex)
{
MessageBox.Show("Connector xml Modified.");
}
}
}
}
//Iterate all nodes connector
/*foreach (XmlNode xmlNodeconnector in currentXmlNode.ChildNodes)
{
if (xmlNodeconnector.NodeType == XmlNodeType.Element)
//.........这里部分代码省略.........
示例13: SelectControl
/////////////////////////////////////////////////////////////////
// PRIVATE METHODS
/////////////////////////////////////////////////////////////////
//
// Attaches a pick box to the sender Control
//
internal void SelectControl(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
return;
if (m_control is Control)
{
m_control.Cursor = UIEventManager.pickBox[(IEIBControl)m_control].oldCursor;
//Remove event any pre-existing event handlers appended by this class
m_control.MouseDown -= new MouseEventHandler(this.ctl_MouseDown);
m_control.MouseMove -= new MouseEventHandler(this.ctl_MouseMove);
m_control.MouseUp -= new MouseEventHandler(this.ctl_MouseUp);
m_control.KeyDown -= new KeyEventHandler(this.ctl_KeyDown);
m_control.KeyUp -= new KeyEventHandler(this.ctl_KeyUp);
m_control.CursorChanged -= new EventHandler(m_control_CursorChanged);
m_control = null;
}
m_control = (Control)sender;
m_control.SuspendLayout();
//Add event handlers for moving the selected control around
m_control.MouseDown += new MouseEventHandler(this.ctl_MouseDown);
m_control.MouseMove += new MouseEventHandler(this.ctl_MouseMove);
m_control.MouseUp += new MouseEventHandler(this.ctl_MouseUp);
m_control.KeyDown += new KeyEventHandler(this.ctl_KeyDown);
m_control.KeyUp += new KeyEventHandler(this.ctl_KeyUp);
//Add sizing handles to Control's container (Form or PictureBox)
for (int i = 0; i < 8; i++)
{
m_control.Parent.Controls.Add(lbl[i]);
lbl[i].BringToFront();
}
//Position sizing handles around Control
MoveHandles();
//Display sizing handles
ShowHandles();
oldCursor = m_control.Cursor;
m_control.Cursor = Cursors.SizeAll;
m_control.CursorChanged += new EventHandler(m_control_CursorChanged);
/*if (!((m_control is EIBFormDesigner.Controls.EIBPicture) || (m_control is EIBFormDesigner.Controls.EIBPanel)))
{
m_control.Cursor = Cursors.SizeAll;
}*/
m_control.ResumeLayout();
//m_control.Invalidate();
}
示例14: SuspendLayout
private static int SuspendLayout(Control Instance,IntPtr l)
{
// get method arguments
// call method
Instance.SuspendLayout();
return 0;
}
示例15: TranslateInterface
internal static void TranslateInterface(Control form, string lang)
{
// Check to see if a the translation file exists in the same folder as the executable
string externalLangPath = "lang_" + lang + ".txt";
string[] rawlist;
if (File.Exists(externalLangPath))
rawlist = File.ReadAllLines(externalLangPath);
else
{
object txt = Properties.Resources.ResourceManager.GetObject("lang_" + lang);
if (txt == null) return; // Translation file does not exist as a resource; abort this function and don't translate UI.
rawlist = ((string)txt).Split(new[] { "\n" }, StringSplitOptions.None);
rawlist = rawlist.Select(i => i.Trim()).ToArray(); // Remove trailing spaces
}
List<string> stringdata = new List<string>();
int start = -1;
for (int i = 0; i < rawlist.Length; i++)
{
// Find our starting point
if (!rawlist[i].Contains("! " + form.Name)) continue;
start = i;
break;
}
if (start < 0)
return;
// Rename Window Title
string[] WindowName = rawlist[start].Split(new[] { " = " }, StringSplitOptions.None);
if (WindowName.Length > 1) form.Text = WindowName[1];
// Fetch controls to rename
for (int i = start + 1; i < rawlist.Length; i++)
{
if (rawlist[i].Length == 0) continue; // Skip Over Empty Lines, errhandled
if (rawlist[i][0] == '-') continue; // Keep translating if line is a comment line
if (rawlist[i][0] == '!') // Stop if we have reached the end of translation
break;
stringdata.Add(rawlist[i]); // Add the entry to process later.
}
if (stringdata.Count == 0)
return;
// Find control then change display Text.
form.SuspendLayout();
foreach (string str in stringdata)
{
string[] SplitString = str.Split(new[] { " = " }, StringSplitOptions.None);
if (SplitString.Length < 2)
continue;
object c = FindControl(SplitString[0], form.Controls); // Find control within Form's controls
if (c == null) // Not found
continue;
string text = SplitString[1]; // Text to set Control.Text to...
if (c is Control)
(c as Control).Text = text;
else if (c is ToolStripItem)
(c as ToolStripItem).Text = text;
}
form.ResumeLayout();
}