码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-02-09 16:09:54      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:initial   click   button   timer   names   宽度   pac   sys   距离   

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();
}
}
}

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

标签:initial   click   button   timer   names   宽度   pac   sys   距离   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!