实现鼠标点击以后,内容水平滚动

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace gundong_Label
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
button2.Enabled = false;
}

private void timer1_Tick(object sender, EventArgs e)
{
label1.Left -=3; //设置label1左边缘与其容器的工作区左边缘之间的距离
if (label1.Right < 0) //当label1右边缘与其容器的工作区左边缘之间的距离小于0时
{
label1.Left = this.Width; //设置label1左边缘与其容器的工作区左边缘之间的距离为该窗体的宽度
}
}
//开始演示
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true; //开始滚动
button2.Enabled = true;

}
//单击暂停按钮
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false; //停止滚动
button2.Enabled = false;
}
//退出
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

原文地址:https://www.cnblogs.com/Echo529/p/6382259.html