一、重绘进度条

public class CustomProgressBar:ProgressBar
{
public CustomProgressBar()
{
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
protected override void OnPaint(PaintEventArgs e)
{
SolidBrush brush = null;
Rectangle rec = new Rectangle(, , this.Width, this.Height); if(ProgressBarRenderer.IsSupported)
{
ProgressBarRenderer.DrawHorizontalBar(e.Graphics, rec);
}
Pen pen = new Pen(this.ForeColor, );
e.Graphics.DrawRectangle(pen, rec);
e.Graphics.FillRectangle(new SolidBrush(this.BackColor), , , rec.Width - , rec.Height - ); rec.Height -= ;
rec.Width = (int)(rec.Width * ((double)Value / Maximum)) - ;
brush = new SolidBrush(this.ForeColor);
e.Graphics.FillRectangle(brush, , , rec.Width, rec.Height);
}
}

C#控件之:进度条(ProgressBar)的更多相关文章

  1. 怎样控制界面控件之进度条(ProgressBar)功能

    一.基础知识: 1.ProgressBar在界面文件XML中的布局: [html] <progressBar android:id="@+id/progressbar_updown&q ...

  2. MFC控件编程进度条编写

    MFC控件编程进度条编写 一丶进度条编程需要用到的方法 进度条MFC已经帮我们封装好类了. 叫做 CProgressCtrl  进度条编程也很简单. 封装的方法也就那个那几个. GetPos()  获 ...

  3. C# 根据BackgroundWoker异步模型和ProgressBar控件,自定义进度条控件

    前言 程序开发过程中,难免会有的业务逻辑,或者算法之类产生让人能够感知的耗时操作,例如循环中对复杂逻辑处理;获取数据库百万乃至千万级数据;http请求的时候等...... 用户在使用UI操作并不知道程 ...

  4. Android中的常用控件之进度条(ProgressBar)

    ProgressBar的常用属性:style,进度条的样式,默认为圆形,用style="?android:attr/progressBarStyleHorizontal"可以将进度 ...

  5. Android自己定义控件:进度条的四种实现方式

    前三种实现方式代码出自: http://stormzhang.com/openandroid/2013/11/15/android-custom-loading/ (源代码下载)http://down ...

  6. Winform之跨线程访问控件(在进度条上显示字体)

    此文章对于遇到必须使用线程但是没有办法在线程内操作控件的问题的处理  有很好的解决方案(个人认为的.有更好的方案欢迎交流.) 在做跨线程访问之前我们先了解下我们所做的需要达到的效果: 这个是批量的将x ...

  7. 2015.3.11 VS异步控件及进度条结合应用

    1.在Form中添加 指针控件:BackgroundWorker-bgwork:进度条控件progressBar1 以及开始.取消按钮 2.开始按钮启动异步线程 private void button ...

  8. 【Qt开发】Qt控件之进度条

    QT 进度条操作实例是本文要介绍的内容,在QT中可以用QProgressBar或着QProgressDialog来实现进度条. QProgressBar的使用   首先在designer中拖一个按钮和 ...

  9. Android自己定义控件--圆形进度条(中间有图diao)

    智能家居越来越流行,在智能家居中我们常要表现一些数据的百分比 圆形度条中间加个图是一种很流行的自己定义View 1.第一步 你首先须要对类进行继承View public class CirclePro ...

  10. 使用timer控件控制进度条

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

随机推荐

  1. vue2.0插件

    1.better-scroll 参考网址:https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/ better-scroll 是什么 firs ...

  2. Python 列表推导实例

    #!/usr/bin/python # -*- coding: utf-8 -*- with open('e:/123.txt') as fp:row = fp.readlines() #打开并读取所 ...

  3. c# 把对象加入队列,对象为全局变量,对象改变队列值也跟着改变

    若程序把对象加入队列,对象为全局变量,对象改变队列值也跟着改变,如下: filecontent  为两个字段的属性值. class FileContent { // public string Htt ...

  4. andorid 手机外部储存

    .xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  5. iOS.AutomatePackageBuild.0-Resource-List

    1. xcodebuild xcodebuild: 构建Xcode project和workspace. 2. TN2339: Building from the Command Lline with ...

  6. Python.Flask.0

    Resource List of Flask 1. 吐槽 Python Web 框架 Flask https://blog.tonyseek.com/post/discuss-about-flask- ...

  7. com_pc-mcu

    #include <REG52.H> unsigned char UART_buff; bit New_rec = , Send_ed = , Money = ; void main (v ...

  8. Jquery中$.each()与$().each()的使用与区别。

    在jquery中,遍历对象和数组,经常会用到$().each和$.each(),两个方法.两个方法是有区别的,从而这两个方法在针对不同的操作上,显示了各自的特点. $().each,对于这个方法,在d ...

  9. IOS初级:story board的跳转

    本文要实现view1跳到view2,view2又跳回view1. 首先要在视图中拉出一条连接view1和view2的线. 下面是在view1的控制器中实现,从view1跳到view2 //发生跳转前会 ...

  10. 18 包 ,logging模块使用

    包: 1 什么是包: 包就是一个包含有__init__.py文件的文件夹 宝本质就是一种模块,即包就是用包导入使用的,包内部包含的文件也都是用来被导入使用 2 为什么要用包 包就是文件夹,那文件加就是 ...