使用标签的百分比



使用按钮+和-百分比从0%到100%不等。有没有什么方法可以在下面的链接(图片)上用标签显示百分比。

图像1

图像2

PS我不习惯使用进度条,但如果有其他更好的方法,请建议

制作+和-按钮以及带有绿色背景的标签。

点击加号或减号调整标签高度和标签上的文本

private void plusButton_Click(object sender, RoutedEventArgs e)
{
    if(percentLength.Height < 100)
        percentLength.Height = percentLength.Height + 10;
}
private void minusButton_Click(object sender, RoutedEventArgs e)
{
    if (percentLength.Height > 0)
        percentLength.Height = percentLength.Height - 10;
}
protected void percentLength_HeightChanged(object sender, EventArgs e)
{
    percentLength.Content = percentLength.Height + "%";
}

最新更新