本文整理汇总了C#中System.Windows.Forms.Label.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Bind方法的具体用法?C# Label.Bind怎么用?C# Label.Bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Label
的用法示例。
在下文中一共展示了Label.Bind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogForm_Load
private void LogForm_Load(object sender, EventArgs e)
{
guiPanel.FlowDirection = FlowDirection.TopDown;
guiPanel.Controls.Clear();
Func<ProgressObject, Control> progressTemplate = (ProgressObject po) => {
var topLabel = new Label() {
Margin = new Padding(0, 5, 0, 5),
Font = new Font(Font.FontFamily, 12f, FontStyle.Bold),
Width = guiPanel.Width - 30,
AutoSize = true
};
var botLabel = new Label() {
Width = guiPanel.Width - 30,
AutoSize = true
};
var progBar = new ProgressBar() {
Margin = new Padding(0, 5, 0, 0),
Width = guiPanel.Width - 30,
AutoSize = true
};
po.TaskTitle.Binding = topLabel.Bind(x => x.Text).ToBinding(BindingMode.FromTarget);
po.TaskText.Binding = botLabel.Bind(x => x.Text).ToBinding(BindingMode.FromTarget);
po.Total.Binding = progBar.Bind(x => x.Maximum).ToBinding(BindingMode.FromTarget);
po.Current.Binding = progBar.Bind(x => x.Value).ToBinding(BindingMode.FromTarget);
progBar.Maximum = po.Total.Value;
progBar.Value = po.Current.Value;
var flowThing = new FlowLayoutPanel() {
FlowDirection = FlowDirection.TopDown,
Margin = new Padding(10, 5, 10, 5),
Width = guiPanel.Width - 30
};
flowThing.Controls.AddRange(new[] {
(Control) topLabel,
botLabel,
progBar
});
return flowThing;
};
List.Binding =
guiPanel.Controls
.CastList().ProjectList(progressTemplate)
.ToBindable()
.WithDispatcher(act => Invoke(act))
.ToBinding(BindingMode.FromTarget);
}