⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 movewordcontrol.cs

📁 当文字的长度大于label的长度时
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace PowerNet.Mobile.Label.ClassLab
{
    public partial class MoveWordControl : UserControl
    {
        private Thread thread  ;
        public MoveWordControl()
        {
            InitializeComponent();
            this.button1.GotFocus += new EventHandler(MoveGotFocus);
            this.button1.LostFocus+=new EventHandler(MoveLostFocus);
             
        }


        delegate void TextMoveDelegate(string text);

        private void TextMove(string text)
        {
            this.button1.Text = text;

        }

        private void TextChange()
        {
            for (int i = 0; i < 8; i++)
            {
                TextMoveDelegate move = new TextMoveDelegate(TextMove);
                this.Invoke(move, i.ToString());
                Thread.Sleep(1000);
            }
        }

        public void StartMoveThread()
        {
            Thread thread = new Thread(new ThreadStart(TextChange));
            thread.Start();
        }

        
        private void MoveGotFocus(object sender, EventArgs e)
        {
            thread = new Thread(new ThreadStart(TextChange));
            thread.Start();
        }

        private void MoveLostFocus(object sender, EventArgs e)
        {
            thread.Abort();
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            thread = new Thread(new ThreadStart(TextChange));
            thread.Start();
        }

         
      
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -