镜子在窗体上移动文本

时间:2011-02-01 15:04:41

标签: c# .net

我在表单上使用从右上角到左上角的移动标签显示“新闻”。

如何将其编程为“镜像”意味着当文本到达表单的末尾(左上角)时,它将继续从右上角移动,但不是整个文本行,因为它可以是一个长字符串。 / p>

另外,如何编程我想要显示的字符串的位置,以便在到达行尾时从特定位置开始? 这是我的代码:

private void MovingNews(String Str)
    {

        mtlb.AutoSize = true;
        mtlb.Text = Str;
        mtlb.Location = new Point(mtlb.Location.X - mtlb.Width, mtlb.Location.Y);

        int x = mtlb.Location.X;
        int y = mtlb.Location.Y;

        MovingTextTimer.Start();

    }
    private void MovingTextTimer_Tick(object sender, EventArgs e)
    {
        if (mtlb.Location.X < 0)
        {
            mtlb.Location = new Point(?, ?); 
        }
        else
        {
            mtlb.Location = new Point(mtlb.Location.X - 2, mtlb.Location.Y);
        }
    }

0 个答案:

没有答案