滚动条上的一个标签 [英] Scrollbar on a Label

查看:96
本文介绍了滚动条上的一个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够我用这一个井字游戏的信贷部分的标签上滚动文本。我怎样才能做到这一点,我们只是一直在教导通过滚动条而不是文本数值来滚动。

 私人无效xGameCreditsButton_Click (对象发件人,EventArgs五)
{
this.xWinnerLabel.BackColor = Color.White;
this.xCreditsScrollBar.Visible = TRUE;
this.xWinnerLabel.Text =成为可能的帮助下这个游戏:等等等等喇嘛;
}


解决方案

而不是一个标签,使用一个TextBox并设置滚动条自动换行属性根据您的需要。要禁用编辑文本框的(因此,使其行为类似于标签),使用的只读属性。


I need to be able to scroll text on a label i am using this for the credits portion of a tic tac toe game. How can I make this happen we've only been taught to scroll through number values in the scrollbar not text.

 private void xGameCreditsButton_Click(object sender, EventArgs e)
        {
            this.xWinnerLabel.BackColor = Color.White;
            this.xCreditsScrollBar.Visible = true;
            this.xWinnerLabel.Text = "This game was made possible with the help of: blah bla blah";
        }

解决方案

Instead of a Label, use a TextBox and set the ScrollBars, MultiLine and WordWrap properties according to your needs. To disable editing of the TextBox (and, thus, make it behave similar to a label), use the ReadOnly property.

这篇关于滚动条上的一个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆