本文整理汇总了C#中System.Windows.Forms.LinkLabel.?.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# LinkLabel.?.Dispose方法的具体用法?C# LinkLabel.?.Dispose怎么用?C# LinkLabel.?.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.LinkLabel
的用法示例。
在下文中一共展示了LinkLabel.?.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateContent
/// <summary>
/// Updates the content.
/// </summary>
private void UpdateContent()
{
// When no certificate class is selected, we just hide the right panel.
if (m_selectedCertificate == null)
{
// View help message
lblHelp.Visible = true;
panelRight.Visible = false;
return;
}
// Hide help message
lblHelp.Visible = false;
// Updates controls visibility
panelRight.Visible = true;
lblName.Text = m_selectedCertificate.Name;
lblCategory.Text = m_selectedCertificate.Category.Name;
textboxDescription.Text = m_selectedCertificate.Certificate.Description;
// Training time per certificate level
for (int i = 1; i <= 5; i++)
{
UpdateLevelLabel(panelHeader.Controls.OfType<Label>()
.First(label => label.Name == $"lblLevel{i}Time"), i);
}
// Only read the recommendations from one level, because they are all the same
PersistentSplitContainer rSplCont = rightSplitContainer;
List<Control> newItems = new List<Control>();
SortedList<string, Item> ships = new SortedList<string, Item>();
foreach (Item ship in m_selectedCertificate.Certificate.Recommendations)
{
ships.Add(ship.Name, ship);
}
Label tempLabel = null;
try
{
tempLabel = new Label();
tempLabel.Font = new Font(tempLabel.Font, FontStyle.Bold);
tempLabel.AutoSize = true;
tempLabel.Dock = DockStyle.Top;
tempLabel.Text = @"Recommended For";
tempLabel.Padding = new Padding(5);
Label tsl = tempLabel;
tempLabel = null;
newItems.Add(tsl);
Size tslTextSize = TextRenderer.MeasureText(tsl.Text, Font);
int panelMinSize = rSplCont.Panel2MinSize;
rSplCont.Panel2MinSize = panelMinSize > tslTextSize.Width + HPad
? panelMinSize
: tslTextSize.Width + HPad;
rSplCont.SplitterDistance = rSplCont.Width - rSplCont.Panel2MinSize;
}
finally
{
tempLabel?.Dispose();
}
foreach (LinkLabel linkLabel in ships.Values
.Select(ship =>
{
LinkLabel linkLabel;
LinkLabel tempLinkLabel = null;
try
{
tempLinkLabel = new LinkLabel();
tempLinkLabel.LinkBehavior = LinkBehavior.HoverUnderline;
tempLinkLabel.Padding = new Padding(16, 0, 0, 0);
tempLinkLabel.Dock = DockStyle.Top;
tempLinkLabel.Text = ship.Name;
tempLinkLabel.Tag = ship;
linkLabel = tempLinkLabel;
tempLinkLabel = null;
}
finally
{
tempLinkLabel?.Dispose();
}
return linkLabel;
}))
{
linkLabel.MouseClick += recommendations_MenuItem;
newItems.Add(linkLabel);
}
// Updates the recommendations for this certificate
UpdateRecommendations(newItems, rSplCont);
//.........这里部分代码省略.........