本文整理匯總了C#中System.Windows.Controls.TextBlock.Select方法的典型用法代碼示例。如果您正苦於以下問題:C# TextBlock.Select方法的具體用法?C# TextBlock.Select怎麽用?C# TextBlock.Select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Controls.TextBlock
的用法示例。
在下文中一共展示了TextBlock.Select方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MeasureOverride
protected override Size MeasureOverride(Size constraint)
{
TextBlock[] tbTime = new TextBlock[] { Time0, Time1, Time2, Time3, Time4 };
TextBlock[] tbVal = new TextBlock[] { Val0, Val1, Val2, Val3, Val4 };
TextBlock[] tbDelta = new TextBlock[] { Delta0, Delta1, Delta2, Delta3, Delta4 };
Size c = new Size(constraint.Width / 5, constraint.Height / 5);
Size d = new Size();
for(int i = 0; i < 5; i++) {
tbTime[i].Measure(c);
tbDelta[i].Measure(c);
tbVal[i].Measure(c);
d.Height += Math.Max(tbDelta[i].DesiredSize.Height, tbVal[i].DesiredSize.Height);
d.Width += tbTime[i].DesiredSize.Width;
}
d.Height += tbTime.Select(x => x.DesiredSize.Height).Max();
d.Width += tbDelta.Select(x => x.DesiredSize.Width).Max();
d.Width += tbVal.Select(x => x.DesiredSize.Width).Max();
d.Height += 50;
d.Width += 50;
d.Height = Math.Min(d.Height, constraint.Height);
d.Width = Math.Min(d.Width, constraint.Width);
return base.MeasureOverride(d);
}