我不知道如何在按钮上显示文本。
现在这是我问题的根源。我有这三个按钮,我想显示一个小文本:“开始”、“停止”和“重置”。
using System.Windows.Controls;
namespace Program.src.View.Main
{
public class LowerActionPanel : StackPanel
{
public LowerActionPanel()
{
this.Orientation = Orientation.Horizontal;
this.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
Button startButton = new Button();
startButton.Width = 90;
startButton.Height = 25;
startButton.Text = "Text"; //(here the problem lies)
this.Children.Add(startButton);
Button stopButton = new Button();
stopButton.Width = 90;
stopButton.Height = 25;
this.Children.Add(stopButton);
Button resetButton = new Button();
resetButton.Width = 90;
resetButton.Height = 25;
this.Children.Add(resetButton);
}
}
}
在另一个问题中,他们使用 .Text 没有任何问题,这让我认为可以只使用它,或者我只是弄错了?
侃侃尔雅
慕妹3146593
相关分类