本文整理汇总了C#中System.Windows.Forms.FlowLayoutPanel.?.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# FlowLayoutPanel.?.Dispose方法的具体用法?C# FlowLayoutPanel.?.Dispose怎么用?C# FlowLayoutPanel.?.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.FlowLayoutPanel
的用法示例。
在下文中一共展示了FlowLayoutPanel.?.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAccountsNotTrainingPanel
/// <summary>
/// Creates a panel contains the warning message for accounts not in training.
/// </summary>
/// <param name="warningMessage"></param>
/// <returns></returns>
private static FlowLayoutPanel CreateAccountsNotTrainingPanel(string warningMessage)
{
// Create a flowlayout to hold the content
FlowLayoutPanel warningPanel;
FlowLayoutPanel tempWarningPanel = null;
try
{
tempWarningPanel = new FlowLayoutPanel
{
AutoSize = true,
AutoSizeMode = AutoSizeMode.GrowAndShrink,
Margin = new Padding(0, 0, 0, 2)
};
// Add a picture on the left with a warning icon
if (!Settings.UI.SafeForWork)
{
int portraitSize = Int32.Parse(Settings.UI.SystemTrayPopup.PortraitSize.ToString().Substring(1),
CultureConstants.InvariantCulture);
PictureBox tempPictureBoxWarning = null;
try
{
tempPictureBoxWarning = new PictureBox();
tempPictureBoxWarning.Image = SystemIcons.Warning.ToBitmap();
tempPictureBoxWarning.SizeMode = PictureBoxSizeMode.StretchImage;
tempPictureBoxWarning.Size = new Size(portraitSize, portraitSize);
tempPictureBoxWarning.Margin = new Padding(2);
PictureBox pbWarning = tempPictureBoxWarning;
tempPictureBoxWarning = null;
tempWarningPanel.Controls.Add(pbWarning);
}
finally
{
tempPictureBoxWarning?.Dispose();
}
}
// Adds a label to hold the message
Label tempLabelMessage = null;
try
{
tempLabelMessage = new Label
{
AutoSize = true,
Text = warningMessage
};
Label lblMessage = tempLabelMessage;
tempLabelMessage = null;
tempWarningPanel.Controls.Add(lblMessage);
}
finally
{
tempLabelMessage?.Dispose();
}
tempWarningPanel.CreateControl();
warningPanel = tempWarningPanel;
tempWarningPanel = null;
}
finally
{
tempWarningPanel?.Dispose();
}
return warningPanel;
}
示例2: PerformCustomLayout
/// <summary>
/// Performs the custom layout.
/// </summary>
private void PerformCustomLayout()
{
// Remove controls and dispose them
IEnumerable<Control> oldControls = MainFlowLayoutPanel.Controls.Cast<Control>().ToList();
MainFlowLayoutPanel.Controls.Clear();
foreach (Control ctl in oldControls)
{
ctl.Dispose();
}
IEnumerable<Character> characters = GetCharacters;
// Add controls for characters
if (Settings.UI.SystemTrayPopup.GroupBy == TrayPopupGrouping.Account &&
Settings.UI.SystemTrayPopup.IndentGroupedAccounts)
{
List<APIKey> prevAPIKeys = new List<APIKey>();
foreach (Character character in characters)
{
OverviewItem charPanel = GetOverviewItem(character);
List<APIKey> apiKeys = character.Identity.APIKeys.ToList();
if (!apiKeys.Exists(apiKey => prevAPIKeys.Contains(apiKey)))
{
MainFlowLayoutPanel.Controls.Add(charPanel);
prevAPIKeys = apiKeys;
}
else
{
FlowLayoutPanel tempAccountGroupPanel = null;
try
{
tempAccountGroupPanel = new FlowLayoutPanel();
tempAccountGroupPanel.Controls.Add(charPanel);
tempAccountGroupPanel.AutoSize = true;
tempAccountGroupPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tempAccountGroupPanel.FlowDirection = FlowDirection.TopDown;
tempAccountGroupPanel.Padding = new Padding(10, 0, 0, 0);
tempAccountGroupPanel.CreateControl();
FlowLayoutPanel accountGroupPanel = tempAccountGroupPanel;
tempAccountGroupPanel = null;
MainFlowLayoutPanel.Controls.Add(accountGroupPanel);
}
finally
{
tempAccountGroupPanel?.Dispose();
}
prevAPIKeys = apiKeys;
}
}
}
else
MainFlowLayoutPanel.Controls.AddRange(characters.Select(GetOverviewItem).ToArray<Control>());
}