• 大小: 27KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-17
  • 语言: 其他
  • 标签:

资源简介

progressMy.zip

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

namespace progressMy
{
    
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        private float m_Value = 0;
        private float m_Maximum = 100;
        private SolidBrush m_ProgressBarFillBrush = new SolidBrush(Color.Green);
        private SolidBrush m_ProgressBarbackColor = new SolidBrush(Color.Red);
        private float text_Value = 100.0f;
        private bool text_target = false;

        private void UserControl1_Paint(object sender PaintEventArgs e)
        {
            Graphics dc = e.Graphics;
            Pen pn = new Pen(ForeColor);
            SolidBrush br = new SolidBrush(m_ProgressBarbackColor.Color);
            SolidBrush br1 = new SolidBrush(m_ProgressBarFillBrush.Color);
            Brush bush = new SolidBrush(ForeColor);//填充的颜色

            initCoordinates(dc br);
            DrawProgressBar(dc m_Value br1);
            if (text_target)
            {
                initDrawString(dc bush text_Value);
            }
        }
        /// 
        /// 绘制进度条背景色
        /// 

        /// 
        /// 
        public void initCoordinates(Graphics dc SolidBrush br)
        {
            dc.FillRectangle(br 0 this.Height / 2 this.Width this.Height / 2);//画矩形
        }

        /// 
        /// 绘制进度条前景色
        /// 

        /// 
        /// 
        /// 
        private void DrawProgressBar(Graphics dc float num SolidBrush br1)
        {
            dc.FillRectangle(br1 0 this.Height / 2 (this.Width) / m_Maximum * num this.Height / 2);//画矩形
        }

        /// 
        /// 绘制进度条文字值
        /// 

        /// 
        /// 
        /// 
        public void initDrawString(Graphics dc Brush bush float i)
        {
            dc.DrawString(((i / 5F) * 0).ToString() Font bush 0 this.Height / this.Font.Size);
            dc.DrawString((i / 5F).ToString() Font bush this.Width / 5F - 15 this.Height / this.Font.Size);
            dc.DrawString(((i / 5F) * 2).ToString() Font bush (this.Width / 5F) * 2 - 15 this.Height / this.Font.Size);
            dc.DrawString(((i / 5F) * 3).ToString() Font bush (this.Width / 5F) * 3 - 15 this.Height / this.Font.Size);
            dc.DrawString(((i / 5F) * 4).ToString() Font bush (this.Width / 5F) * 4 - 15 this.Height / this.Font.Size);
            dc.DrawString(i.ToString() Font bush (this.Width / 5F) * 5 - 35

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-09 17:15  progressMy\
     目录           0  2019-01-09 15:47  progressMy\Properties\
     文件        1318  2019-01-09 15:47  progressMy\Properties\AssemblyInfo.cs
     文件        1470  2019-01-09 16:58  progressMy\UserControl1.Designer.cs
     文件        5982  2019-01-09 17:15  progressMy\UserControl1.cs
     文件        5817  2019-01-09 16:58  progressMy\UserControl1.resx
     目录           0  2019-01-09 15:47  progressMy\bin\
     目录           0  2019-01-09 15:47  progressMy\bin\Debug\
     文件        8192  2019-01-09 17:16  progressMy\bin\Debug\progressMy.dll
     文件       22016  2019-01-09 17:16  progressMy\bin\Debug\progressMy.pdb
     目录           0  2019-01-09 15:47  progressMy\obj\
     目录           0  2019-01-09 17:00  progressMy\obj\Debug\
     文件        6940  2019-01-09 16:56  progressMy\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2019-01-09 17:19  progressMy\obj\Debug\TempPE\
     文件           0  2019-01-09 15:47  progressMy\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
     文件           0  2019-01-09 15:47  progressMy\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
     文件           0  2019-01-09 15:47  progressMy\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
     文件         180  2019-01-09 17:00  progressMy\obj\Debug\progressMy.UserControl1.resources
     文件          42  2019-01-09 15:47  progressMy\obj\Debug\progressMy.csproj.CoreCompileInputs.cache
     文件         730  2019-01-09 17:11  progressMy\obj\Debug\progressMy.csproj.FileListAbsolute.txt
     文件         946  2019-01-09 17:00  progressMy\obj\Debug\progressMy.csproj.GenerateResource.cache
     文件       10320  2019-01-09 16:55  progressMy\obj\Debug\progressMy.csprojAssemblyReference.cache
     文件        8192  2019-01-09 17:16  progressMy\obj\Debug\progressMy.dll
     文件       22016  2019-01-09 17:16  progressMy\obj\Debug\progressMy.pdb
     文件        2646  2019-01-09 16:56  progressMy\progressMy.csproj

评论

共有 条评论

相关资源