[问题] 如何让进度条一遍又一遍的从头到尾的走,速度没有限定,差不多就行,直到某一函数结束。

asgard 2004-08-19 01:39:49
还有就是在进度条一遍遍前进的时候,如何让form中的一个lable上的汉字一闪一闪的?
谢谢。
...全文
283 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
biglong888 2004-08-22
  • 打赏
  • 举报
回复
这是个WinForm的程序,原理就是通过定时器,控制Label的可见与不可见,来实现文字的闪动效果!
asgard 2004-08-20
  • 打赏
  • 举报
回复
ding
nocolor 2004-08-19
  • 打赏
  • 举报
回复
引用using System.Threading;

在代码中写Thread ds_test = new Thread(new ThreadStart(test));//test为函数名
ds_test.IsBackground=true;
ds_test.Start();

void text()
{
}
asgard 2004-08-19
  • 打赏
  • 举报
回复
进度条那个东东呢?
阿云ivan 2004-08-19
  • 打赏
  • 举报
回复
Timer和Label的可见属性结合使用即可
asgard 2004-08-19
  • 打赏
  • 举报
回复
asgard 2004-08-19
  • 打赏
  • 举报
回复
还是不会。。。
asgard 2004-08-19
  • 打赏
  • 举报
回复
form的。
vzxq 2004-08-19
  • 打赏
  • 举报
回复
你的程序是web 的还是form的
yangzhenhai 2004-08-19
  • 打赏
  • 举报
回复
用多线程吧!
biglong888 2004-08-19
  • 打赏
  • 举报
回复
没用过进度条,帮你实现Label闪动吧!^_^


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication2
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Timers.Timer timer1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.timer1 = new System.Timers.Timer();
((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(80, 88);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "闪动";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.SynchronizingObject = this;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{
this.label1.Visible = true;
this.timer1.Interval = 500; //设置闪动的间隔时间
this.timer1.Start(); //计时器开始
this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Elapsed);
}

private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if(this.label1.Visible == false)
this.label1.Visible = true;
else if(this.label1.Visible == true)
this.label1.Visible = false;
}
}
}
asgard 2004-08-19
  • 打赏
  • 举报
回复
丁页 !
asgard 2004-08-19
  • 打赏
  • 举报
回复
我不会线程,能不能给点示例代码,谢谢。还有我说的一闪一闪的不是指汉字的颜色不变,是指汉字一下显示出来一下不显示出来
twodays 2004-08-19
  • 打赏
  • 举报
回复
步骤如下:
1)将你要调用的函数单独使用一个线程来调用
2)设定一个计时器,定一个时间间隔,然后让进度条前进,当进度条到头的时候,进度条的Value归零
3)在设定一个计数器,定制第二个时间间隔(或者也就利用第一个计时器),来改变那个Label上的颜色(例如,第一次颜色是红色,第二次过来就改变成绿色,第三次就是红色。。。。。)
4)在你调用的那个线程结束后,再来停止计数器。

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧