设为首页 加入收藏

TOP

(七十三)c#Winform自定义控件-资源加载窗体(一)
2019-09-26 11:12:03 】 浏览:91
Tags:七十三 c#Winform 定义 控件 资源 加载 窗体

前提

入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章。

GitHub:https://github.com/kwwwvagaa/NetWinformControl

码云:https://gitee.com/kwwwvagaa/net_winform_custom_control.git

如果觉得写的还行,请点个 star 支持一下吧

欢迎前来交流探讨: 企鹅群568015492 企鹅群568015492

麻烦博客下方点个【推荐】,谢谢

NuGet

Install-Package HZH_Controls

目录

https://www.cnblogs.com/bfyx/p/11364884.html

用处及效果

准备工作

这个用到了基类窗体  (十七)c#Winform自定义控件-基类窗体 ,如果不了解可以先移步看一下

开始

添加一个窗体FrmLoading 继承 FrmBase

东西不多,看全部代码

  1 // ***********************************************************************
  2 // Assembly         : HZH_Controls
  3 // Created          : 2019-09-26
  4 //
  5 // ***********************************************************************
  6 // <copyright file="FrmLoading.cs">
  7 //     Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
  8 // </copyright>
  9 //
 10 // Blog: https://www.cnblogs.com/bfyx
 11 // GitHub:https://github.com/kwwwvagaa/NetWinformControl
 12 // gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
 13 //
 14 // If you use this code, please keep this note.
 15 // ***********************************************************************
 16 using System;
 17 using System.Collections.Generic;
 18 using System.ComponentModel;
 19 using System.Data;
 20 using System.Drawing;
 21 using System.Linq;
 22 using System.Text;
 23 using System.Threading;
 24 using System.Windows.Forms;
 25 
 26 namespace HZH_Controls.Forms
 27 {
 28     /// <summary>
 29     /// Class FrmLoading.
 30     /// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
 31     /// </summary>
 32     /// <seealso cref="HZH_Controls.Forms.FrmBase" />
 33     public partial class FrmLoading : FrmBase
 34     {
 35         /// <summary>
 36         /// The update database worker
 37         /// </summary>
 38         BackgroundWorker updateDBWorker = new BackgroundWorker();
 39         /// <summary>
 40         /// 获取或设置加载任务
 41         /// </summary>
 42         /// <value>The background work action.</value>
 43         public Action BackgroundWorkAction
 44         {
 45             get;
 46             set;
 47         }
 48         /// <summary>
 49         /// 设置当前执行进度及任务名称,key:任务进度,取值0-100  value:当前任务名称
 50         /// </summary>
 51         /// <value>The current MSG.</value>
 52         public KeyValuePair<int, string> CurrentMsg
 53         {
 54             set
 55             {
 56                 this.updateDBWorker.ReportProgress(value.Key, value.Value);
 57             }
 58         }
 59         /// <summary>
 60         /// Initializes a new instance of the <see cref="FrmLoading"/> class.
 61         /// </summary>
 62         public FrmLoading()
 63         {
 64             InitializeComponent();
 65             this.updateDBWorker.WorkerReportsProgress = true;
 66             this.updateDBWorker.WorkerSupportsCancellation = true;
 67             this.updateDBWorker.DoWork += new DoWorkEventHandler(this.backgroundWorker1_DoWork);
 68             this.updateDBWorker.ProgressChanged += new ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
 69         }
 70         /// <summary>
 71         /// 设置进度信息,重写此函数可以处理界面信息绑定
 72         /// </summary>
 73         /// <param name="strText">进度任务名称</param>
 74         /// <param name="intValue">进度值</param>
 75         protected virtual void BindingProcessMsg(string strText, int intValue)
 76         {
 77 
 78         }
 79 
 80         /// <summary>
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇MD5加密实现方法 下一篇Winform组合ComboBox和TreeView实..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目