登录
首页 » C#源码 » Visual C# Timer 构建的进度条演示

Visual C# Timer 构建的进度条演示

于 2022-04-16 发布 文件大小:13.03 kB
0 59
下载积分: 2 下载次数: 1

代码说明:

Visual C# Timer 构建的进度条演示,progressBar进度条的建立与使用,简单的范例,面向C#的初级开发者,希望初学者能够熟悉Loading如何创作哦,以下代码可以参考:   private void timer1_Tick(object sender, EventArgs e)   {    //使用三元运算符为progressBar的Value值自加1    progressBar1.Value = ++progressBar1.Value > 1000 - 1 ? 0 : progressBar1.Value;    //显示载入百分比    label2.Text = string.Format("已经载入{0}%", (int)(progressBar1.Value / 1000f * 100));   }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • C# 设置应用程序背景颜色
    C# 设置应用程序背景颜色,通过调用Windows调色板,来选取颜色,然后程序将颜色值赋值给窗口,此盒子可设置斜体的颜色值,运行效果如参考截图所示,核心代码请看以下代码片段:   private void Form1_Load(object sender, EventArgs e)   {//显示应用程序背景颜色    //先打开“Properties”,添加一个System.Drawing.Color类型的变量MyBackColor    this.BackColor = Properties.Settings.Default.MyBackColor;   }   private void button1_Click(object sender, EventArgs e)   {//设置应用程序背景颜色(在运行时编写用户设置)    if(this.colorDialog1.ShowDialog()==DialogResult.OK)    {    Properties.Settings.Default.MyBackColor = this.colorDialog1.Color;    Properties.Settings.Default.Save();    this.BackColor = Properties.Settings.Default.MyBackColor;    }   }
    2022-06-22 05:36:16下载
    积分:1
  • C# 向StatusBar状态栏控件中添加窗格面板
    C# 向StatusBar状态栏控件中添加窗格面板及文字,也就是把窗口的状态栏分栏,分隔成若干个小区域,显示不同的信息,比如文字提示或图标等。   向StatusBar控件添加窗格面板   StatusBar statusBar1=new StatusBar();   statusBar1.Panels.Add("中华人民共和国");   statusBar1.Panels.Add("重庆市");   statusBar1.Panels.Add("罗斌");   statusBar1.Panels[0].AutoSize = StatusBarPanelAutoSize.Contents;   statusBar1.Panels[1].AutoSize = StatusBarPanelAutoSize.Spring;   statusBar1.Panels[2].AutoSize = StatusBarPanelAutoSize.Contents;   statusBar1.Panels[0].BorderStyle =StatusBarPanelBorderStyle.Raised;   statusBar1.Panels[1].BorderStyle = StatusBarPanelBorderStyle.Sunken;   statusBar1.Panels[2].BorderStyle = StatusBarPanelBorderStyle.Raised;   statusBar1.Panels[2].Icon = new System.Drawing.Icon( @"Error.ico");   statusBar1.ShowPanels = true;   this.Controls.Add(statusBar1);
    2022-05-17 04:53:06下载
    积分:1
  • C# 获取当前时区的标准时区名称
    C# 获取当前时区的标准时区名称:private void button1_Click(object sender, EventArgs e)   {//获取当前时区的标准时区名称    var MyInfo="当前时区的标准名称是:";    if(TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now))    MyInfo+= TimeZone.CurrentTimeZone.DaylightName;    else    MyInfo+= TimeZone.CurrentTimeZone.StandardName;    MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK);   }
    2022-04-27 18:00:04下载
    积分:1
  • C# 返回用户点击按钮的枚举
    C# 返回用户点击按钮的枚举,这个比较有点个性了,平时好像用的不多,返回用户单击按钮后的信息,需要进行用户单击的判断,代码如下:   DialogResult dr = MessageBox.Show("消息信息", "标题", MessageBoxButtons.YesNoCancel);   switch (dr)//使用switch语句判断用户点击了哪个按钮   {    case DialogResult.Cancel://如果按下了Cancel则执行下面的语句块    MessageBox.Show("按下了Cancel");    break;    case DialogResult.No://如果按下了No则执行下面的语句块    MessageBox.Show("按下了No");    break;    case DialogResult.Yes://如果按下了Yes则执行下面的语句块    MessageBox.Show("按下了Yes");    break;   }
    2023-02-16 09:40:03下载
    积分:1
  • C#调用存储过程显示客户的订单金额
    Visual C# 通过调用存储过程显示客户的订单金额,获取客户的订单总额(获取存储过程参数的返回值):   private void button1_Click(object sender, EventArgs e)   {//获取客户的订单总额(获取存储过程参数的返回值)    DataClasses1DataContext MyDataContext = new DataClasses1DataContext();    string MyCustomer = "alfki";    decimal? MyAmount = 0;    MyDataContext.CustOrderTotal(MyCustomer, ref MyAmount);    MessageBox.Show(MyCustomer+"客户的订单金额是:"+MyAmount.ToString(),"信息提示",MessageBoxButtons.OK);   }
    2022-10-21 01:10:03下载
    积分:1
  • C# 使用Graphics对象在程序运行时创建位图
    C# 在程序运行时创建位图,本源码实例主要是学习使用使用Graphics对象创建简单图像的例子,本程序将生成一条曲线图像,参照如下代码:   {//在程序运行时创建位图   int MyWidth=this.pictureBox1.Width;   int MyHeight=this.pictureBox1.Height;   Bitmap MyBitmap = new Bitmap(MyWidth,MyHeight);   Graphics MyGraphics = Graphics.FromImage(MyBitmap);   Pen MyPen = new Pen(Color.Black, 3);   Point[] MyPoints = { new Point(50, 100), new Point(100, 10), new Point(150, 290), new Point(200, 100), new Point(250, 10), new Point(300, 290), new Point(350, 100) };   MyGraphics.Clear(Color.White);   MyGraphics.DrawBeziers(MyPen, MyPoints);   pictureBox1.Image = MyBitmap;
    2022-03-25 22:38:21下载
    积分:1
  • C# WPF 功能打印的示例
    C# WPF 功能打印的示例,加载内容后,可在本程序中直接打印出XAML文档。   private void button2_Click(object sender, RoutedEventArgs e)   {//打印文件    PrintDialog MyDialog = new PrintDialog();    if ((MyDialog.ShowDialog() == true))    {    MyDialog.PrintVisual(this.richTextBox1 as Visual, "我的XAML打印文档");    }   }   private void button3_Click(object sender, RoutedEventArgs e)   {//保存文件    string MyFileName = "MyFile.XAML";    TextRange MyTextRange;    System.IO.FileStream MyStream;    MyTextRange = new TextRange(this.richTextBox1.Document.ContentStart, this.richTextBox1.Document.ContentEnd);    MyStream = new System.IO.FileStream(MyFileName, System.IO.FileMode.Create);    MyTextRange.Save(MyStream, DataFormats.XamlPackage);    MyStream.Close();   }
    2022-01-23 10:57:00下载
    积分:1
  • vb串口调试助手,可用于自己做调试测试工具
    1.用易懂的VB语言编程   2.可设置串口号波特率   3.支持十六进或字符形式发送或接收,可定时发送。3,可自己换程序的图片
    2022-07-13 02:02:52下载
    积分:1
  • Visual C# WPF 实现文字左右流动(滚动)效果
    Visual C# WPF技术实现文字内容从左向右流动、从右向左流动,其实就是文字滚动,稍加了一些特殊处理,下面来看看代码真的好简单:   private void button1_Click(object sender, RoutedEventArgs e)   {//内容从左向右流动    this.MyFlowDocument.FlowDirection = FlowDirection.LeftToRight;   }   private void button2_Click(object sender, RoutedEventArgs e)   {//内容从右向左流动    this.MyFlowDocument.FlowDirection = FlowDirection.RightToLeft;   }
    2022-02-04 14:45:10下载
    积分:1
  • C# 查询订购产品ID为51的客户信息
    C# 查询订购产品ID为51的客户信息,需要连接数据库来测试,相关代码分享如下:   //查询订购产品ID为51的客户信息   SqlConnection MyConnection = new SqlConnection(@"Data Source =luobin-PCSQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True");   MyConnection.Open();   DataSet MyDataSet = new DataSet("CustomerOrdersDetails");   SqlDataAdapter MyCustomerAdapter = new SqlDataAdapter("SELECT * FROM Customers", MyConnection);   MyCustomerAdapter.Fill(MyDataSet, "Customers");   DataTable MyTable = new DataTable();   MyCustomerAdapter.Fill(MyTable);   SqlDataAdapter MyOrderAdapter = new SqlDataAdapter("SELECT * FROM Orders", MyConnection);   MyOrderAdapter.Fill(MyDataSet, "Orders");   SqlDataAdapter MyDetailAdapter = new SqlDataAdapter("SELECT * FROM [Order Details]", MyConnection);   MyDetailAdapter.Fill(MyDataSet, "OrderDetails");   MyConnection.Close();   MyDataSet.Relations.Add("CustOrders",MyDataSet.Tables["Customers"].Columns["CustomerID"],MyDataSet.Tables["Orders"].Columns["CustomerID"]).Nested = true;   MyDataSet.Relations.Add(
    2023-04-28 12:35:03下载
    积分:1
  • 696518资源总数
  • 104269会员总数
  • 31今日下载