日期:2014-05-17  浏览次数:20787 次

Winform 关于文字移动的问题!!??
小弟现在想做一个关于label从下往上移动的窗体。基本功能已实现,但效果不理想,不理想在哪呢?在一段文字走完了以后,会出现一屏的空白。望大侠们赐教下!!!

基本代码如下:


  int loc_text = 0;
 private void timer1_Tick(object sender, EventArgs e)
        {
            int FWidth = this.panel1.Width;
            int FHeight = this.panel1.Height;

            Point LPos = new Point(this.label1.Location.X, this.label1.Location.Y);
            if (LPos.Y < FHeight)
            {
                if (LPos.Y < -loc_text)
                {
                    this.label1.Location = new Point(0, this.Height - 72); return;
                }

                this.label1.Location = new Point(LPos.X, LPos.Y - 10);
                return;
            }
            else
            {
                this.label1.Location = new Point(0, 0);
            }
        }


 private void JCZ_SendNews_Load(object sender, EventArgs e)
        {
            this.label1.Location = new Point(0, this.Height - 72);
            label1.Text = "      紧急通知\n由于近期物价高涨,燃油价格也高涨,反正就是什么都贵了。为了体现中国加入WTO与国际接轨的精神,本店铺也将提价10%,表示对国家的物质文明建设的贡献!";

            int sumChar = label1.Text.Length;
            int rowCount = (sumChar / 10) + 1;
            label1.Height = rowCount * 100;
            loc_text = rowCount * 100;
            label1.Size = new Size(1024, label1.Height);
            label1.Font = new Font("黑体", 72);
            label1.ForeColor = Color.Red;
            this.BackColor =&nbs