C#控件之:进度条(ProgressBar)
一、重绘进度条
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)的更多相关文章
- 怎样控制界面控件之进度条(ProgressBar)功能
一.基础知识: 1.ProgressBar在界面文件XML中的布局: [html] <progressBar android:id="@+id/progressbar_updown&q ...
- MFC控件编程进度条编写
MFC控件编程进度条编写 一丶进度条编程需要用到的方法 进度条MFC已经帮我们封装好类了. 叫做 CProgressCtrl 进度条编程也很简单. 封装的方法也就那个那几个. GetPos() 获 ...
- C# 根据BackgroundWoker异步模型和ProgressBar控件,自定义进度条控件
前言 程序开发过程中,难免会有的业务逻辑,或者算法之类产生让人能够感知的耗时操作,例如循环中对复杂逻辑处理;获取数据库百万乃至千万级数据;http请求的时候等...... 用户在使用UI操作并不知道程 ...
- Android中的常用控件之进度条(ProgressBar)
ProgressBar的常用属性:style,进度条的样式,默认为圆形,用style="?android:attr/progressBarStyleHorizontal"可以将进度 ...
- Android自己定义控件:进度条的四种实现方式
前三种实现方式代码出自: http://stormzhang.com/openandroid/2013/11/15/android-custom-loading/ (源代码下载)http://down ...
- Winform之跨线程访问控件(在进度条上显示字体)
此文章对于遇到必须使用线程但是没有办法在线程内操作控件的问题的处理 有很好的解决方案(个人认为的.有更好的方案欢迎交流.) 在做跨线程访问之前我们先了解下我们所做的需要达到的效果: 这个是批量的将x ...
- 2015.3.11 VS异步控件及进度条结合应用
1.在Form中添加 指针控件:BackgroundWorker-bgwork:进度条控件progressBar1 以及开始.取消按钮 2.开始按钮启动异步线程 private void button ...
- 【Qt开发】Qt控件之进度条
QT 进度条操作实例是本文要介绍的内容,在QT中可以用QProgressBar或着QProgressDialog来实现进度条. QProgressBar的使用 首先在designer中拖一个按钮和 ...
- Android自己定义控件--圆形进度条(中间有图diao)
智能家居越来越流行,在智能家居中我们常要表现一些数据的百分比 圆形度条中间加个图是一种很流行的自己定义View 1.第一步 你首先须要对类进行继承View public class CirclePro ...
- 使用timer控件控制进度条
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
随机推荐
- Android Studio 运行shell
public void RunCmd(String mycmd) { Process su = null; try { su = Runtime.getRuntime().exec("su& ...
- ORACLE数据库的关闭与重启
一.关闭数据库 1.SHUTDOWN IMMEDIATE 这是我们常用的一种关闭数据库的方式,想很快地关闭数据库,但又想让数据库干净的关闭,常采用这种方式. 当前正在被Oracle处理的SQL语句立即 ...
- 在pom.xml中引入jar包坐标的依赖范围
A依赖B,需要在A的pom.xml文件中添加B的坐标,添加坐标时需要指定依赖范围,依赖范围包括: compile:编译范围,指A在编译时依赖B,此范围为默认依赖范围.编译范围的依赖会用在编译.测试.运 ...
- 比特币测试网络搭建以及RPC服务开启-配置注意事项
.bitcoin QA Test环境 启动指定参数: "C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe" -testnet -serve ...
- tiny4412SDK 1312B 启动ubuntuDsektop
1,解压光盘所带文件ubuntu-desktop-sdcard-image-YYYYMMDD.tar.gz , 得到ubuntudesktop-8g.raw 2,先用SD-flash刷写一边B盘ima ...
- PL/SQL的快捷键设置
PL/SQL用来连接Oracle数据库的一种工具,它可以设置快捷方式,以便于我们快速的操作. PL/SQL设置快捷键 tools->Preferences(首选项)->User In ...
- Oracle_SQL(4) DDL 表和约束
数据库对象分为占存储空间的对象和不占存储存储空间的对象.占存储空间的对象主要包括:表.索引等.select distinct segment_type from dba_segments order ...
- hdu 1539 & poj 1416 某某公司
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1539 大意是输入n和m,把m按顺序拆分成若干个数,问这些数和的在小于n的前提下最大为多少 注意必须m的 ...
- 枚举之后define
经常会看到类似下边的code写法,觉得这么写没什么意义. enum { AA, BB, CC, }; #define AA AA #define BB BB #define CC CC 尝试下边代码, ...
- abp项目中无法使用HttpContext.Current.Session[""]的问题
web项目Global.asax.cs中加入如下代码 public override void Init() { this.PostAuthenticateRequest += (sender, e) ...