本文整理汇总了C#中System.Windows.Forms.LinkLabel.GetPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:C# LinkLabel.GetPreferredSize方法的具体用法?C# LinkLabel.GetPreferredSize怎么用?C# LinkLabel.GetPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.LinkLabel
的用法示例。
在下文中一共展示了LinkLabel.GetPreferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LayoutProcessesInfo
private void LayoutProcessesInfo()
{
int x = this.labelAccount.Location.X;
const int progressDx = 20;
int y = labelDomainExample.Location.Y + labelDomainExample.Size.Height + 6;
Size preferredSize;
int maxLineDx = this.Size.Width - 2 * x;
foreach (var test in Tests)
{
var l = new Label();
l.ForeColor = System.Drawing.Color.Black;
l.AutoSize = true;
l.Location = new System.Drawing.Point(x, y);
l.Text = test.DisplayName;
preferredSize = l.GetPreferredSize(new Size(maxLineDx, 13));
l.Size = preferredSize;
l.Show();
test.Label = l;
this.Controls.Add(l);
int dy = preferredSize.Height;
int dx = preferredSize.Width;
var pi = new ProgressIndicator();
pi.Location = new Point(x + dx + 4, y-3);
pi.Size = new Size(progressDx, dy);
test.ProgressIndicator = pi;
this.Controls.Add(pi);
pi.Start();
y += (dy + 6);
}
FinishedCountLabel = new Label();
FinishedCountLabel.Visible = true;
FinishedCountLabel.Location = new Point(x, y);
FinishedCountLabel.Text = String.Format("Finished 0 out {0} tests.", Tests.Count);
FinishedCountLabel.Location = new Point(x, y);
//preferredSize = FinishedCountLabel.GetPreferredSize(new Size(maxLineDx, 13));
//FinishedCountLabel.Size = preferredSize;
FinishedCountLabel.AutoSize = true;
this.Controls.Add(FinishedCountLabel);
SeeResultsLabel = new LinkLabel();
SeeResultsLabel.Visible = false;
SeeResultsLabel.Location = new Point(x, y);
SeeResultsLabel.Text = "See results";
preferredSize = SeeResultsLabel.GetPreferredSize(new Size(maxLineDx, 13));
SeeResultsLabel.Size = preferredSize;
SeeResultsLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkLabel_Clicked);
y += (preferredSize.Height + buttonExit.Size.Height + 30);
this.Controls.Add(SeeResultsLabel);
if (ClientSize.Height < y)
ClientSize = new Size(this.ClientSize.Width, y);
}