(三十七)c#Winform自定义控件-有标题的面板-HZHControls
官网
前提
入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章。
GitHub:https://github.com/kwwwvagaa/NetWinformControl
码云:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
如果觉得写的还行,请点个 star 支持一下吧
欢迎前来交流探讨: 企鹅群568015492 idkey=6e08741ef16fe53bf0314c1c9e336c4f626047943a8b76bac062361bab6b4f8d">
目录
https://www.cnblogs.com/bfyx/p/11364884.html
准备工作
用到了控件基类 UCControlBase,如果你还不了解UCControlBase,请移步 (一)c#Winform自定义控件-基类控件 查看
开始
添加一个用户控件,命名UCPanelTitle,继承自UCControlBase
2个属性
[Description("边框颜色"), Category("自定义")]
public Color BorderColor
{
get { return this.RectColor; }
set
{
this.RectColor = value;
this.lblTitle.BackColor = value;
}
}
[Description("面板标题"), Category("自定义")]
public string Title
{
get { return lblTitle.Text; }
set { lblTitle.Text = value; }
}
全部代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms; namespace HZH_Controls.Controls
{
public partial class UCPanelTitle : UCControlBase
{
[Description("边框颜色"), Category("自定义")]
public Color BorderColor
{
get { return this.RectColor; }
set
{
this.RectColor = value;
this.lblTitle.BackColor = value;
}
} [Description("面板标题"), Category("自定义")]
public string Title
{
get { return lblTitle.Text; }
set { lblTitle.Text = value; }
}
public UCPanelTitle()
{
InitializeComponent();
}
}
}
namespace HZH_Controls.Controls
{
partial class UCPanelTitle
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region 组件设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.lblTitle = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lblTitle.ForeColor = System.Drawing.Color.White;
this.lblTitle.Location = new System.Drawing.Point(, );
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(, );
this.lblTitle.TabIndex = ;
this.lblTitle.Text = "面板";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// UCPanelTitle
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent;
this.ConerRadius = ;
this.Controls.Add(this.lblTitle);
this.FillColor = System.Drawing.Color.White;
this.IsRadius = true;
this.IsShowRect = true;
this.Name = "UCPanelTitle";
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.Size = new System.Drawing.Size(, );
this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label lblTitle;
}
}
用处及效果

最后的话
如果你喜欢的话,请到 https://gitee.com/kwwwvagaa/net_winform_custom_control 点个星 星吧
(三十七)c#Winform自定义控件-有标题的面板-HZHControls的更多相关文章
- winform 自定义控件属性在属性面板中显示
Jan.David Nothing is impossible, the word itself says 'I'm possible'!" — Audrey Hepburn winform ...
- (二十四)c#Winform自定义控件-单标题窗体
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- (三)c#Winform自定义控件-有图标的按钮
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- (五十七)c#Winform自定义控件-传送带(工业)-HZHControls
官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...
- (五十六)c#Winform自定义控件-瓶子(工业)-HZHControls
官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...
- (五十九)c#Winform自定义控件-池子(工业)-HZHControls
官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...
- (六十一)c#Winform自定义控件-信号灯(工业)-HZHControls
官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...
- (六十三)c#Winform自定义控件-箭头(工业)-HZHControls
官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...
- winform 自定义控件(高手)
高手推荐:https://www.cnblogs.com/bfyx/p/11364884.html c#Winform自定义控件-目录 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件 ...
随机推荐
- ACM-ICPC 2018 徐州赛区网络预赛 H. Ryuji doesn't want to study (线段树)
Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, ea ...
- 《Java知识应用》Java-线程池(ScheduledExecutorService)
先回顾一下,Runnable 的使用方法. package demo.knowledgepoints.scheduledtask.run; /*** * 线程类 */public class Thre ...
- Java题库——Chapter17 二进制I/0
Introduction to Java Programming 的最后一章,完结撒花!Chapter 17 Binary I/O Section 17.2 How is I/O Handled in ...
- ASP.NET MVC项目中EntityFramework"代码优先方法"的使用步骤
EF提供了三种方式来实现项目,分别是: (1)代码优先方法: (2)模型优先方法: (3)数据库优先方法: 本篇主要记录在Vs2010环境下使用代码优先的方式实现数据库和后端代码数据交互,语言为C#, ...
- wx-all
学习这部分时也学了不少代码,一段一段往这上面写实在有点~~~ 直接把代码部署到代码该在的地方吧,哈哈哈 这是网址 把代码放这上面就好多了,不怕代码丢,还可保证代码完整,嘻嘻嘻~~~~~~
- Linux 周期任务
一次性任务 在某个特定的时间,执行一次后被清除 相关命令/进程 at 命令 atd进程 在centos6中,系统服务的名称: /etc/init.d/atd 查看系统上该进程时候启动: [root@e ...
- DataGridView自动保存列的宽度和位置
WinForm程序中表单的自动保存列的宽度和位置,是一种常见的功能,对于用户体验来说是非常好的.现记录一下实现过程: 1.新建一个类,命为为:DataGridViewColumnStyle. 这个类实 ...
- SAP-BP 创建客商(摘抄)
FORM frm_bp02 . * 更改供应商所需变量 DATA:l_xfeld TYPE xfeld, "复选框 ls_data TYPE vmds_ei_main, "供应商总 ...
- Exceptionless应用--自定义插件
遇到的问题/需求 这里会把一些敏感的参数记录下来,我们需要屏蔽掉,如图 我们希望日志里面有当前登录用户的信息,如图: 处理方法 tip:这里用的是.net非.net core 第一个问题(屏蔽敏感参数 ...
- GO基础之文件操作
一.文件操作的基本API func main() { //绝对路径 fileInfo , err := os.Stat("E:/a.txt") fileInfo , err = o ...