(二十五)c#Winform自定义控件-有确定取消的窗体(一)
官网
前提
入行已经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
准备工作
这个窗体继承子基类窗体FrmWithTitle,如果你对FrmWithTitle还不了解,请移步 (二十四)c#Winform自定义控件-单标题窗体 查看
开始
添加一个Form,命名FrmWithOKCancel1,继承FrmWithTitle
代码不多,直接上全部代码
// 版权所有 黄正辉 交流群:568015492 QQ:623128629
// 文件名称:FrmWithOKCancel1.cs
// 创建日期:2019-08-15 16:05:16
// 功能描述:FrmWithOKCancel1
// 项目地址:https://gitee.com/kwwwvagaa/net_winform_custom_control
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; namespace HZH_Controls.Forms
{
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public partial class FrmWithOKCancel1 : FrmWithTitle
{
public FrmWithOKCancel1()
{
InitializeComponent();
} private void btnOK_BtnClick(object sender, EventArgs e)
{
DoEnter();
} private void btnCancel_BtnClick(object sender, EventArgs e)
{
DoEsc();
} protected override void DoEnter()
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
} private void FrmWithOKCancel1_VisibleChanged(object sender, EventArgs e)
{
}
}
}
namespace HZH_Controls.Forms
{
partial class FrmWithOKCancel1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows Form Designer generated code /// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmWithOKCancel1));
this.btnOK = new HZH_Controls.Controls.UCBtnExt();
this.btnCancel = new HZH_Controls.Controls.UCBtnExt();
this.panel3 = new System.Windows.Forms.Panel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.BackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnBackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.btnOK.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.btnOK.BtnText = "确定";
this.btnOK.ConerRadius = ;
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnOK.FillColor = System.Drawing.Color.White;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnOK.IsRadius = false;
this.btnOK.IsShowRect = false;
this.btnOK.IsShowTips = false;
this.btnOK.Location = new System.Drawing.Point(, );
this.btnOK.Margin = new System.Windows.Forms.Padding();
this.btnOK.Name = "btnOK";
this.btnOK.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.btnOK.RectWidth = ;
this.btnOK.Size = new System.Drawing.Size(, );
this.btnOK.TabIndex = ;
this.btnOK.TabStop = false;
this.btnOK.TipsText = "";
this.btnOK.BtnClick += new System.EventHandler(this.btnOK_BtnClick);
//
// btnCancel
//
this.btnCancel.BackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnBackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.btnCancel.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.btnCancel.BtnText = "取消";
this.btnCancel.ConerRadius = ;
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnCancel.FillColor = System.Drawing.Color.White;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnCancel.IsRadius = false;
this.btnCancel.IsShowRect = false;
this.btnCancel.IsShowTips = false;
this.btnCancel.Location = new System.Drawing.Point(, );
this.btnCancel.Margin = new System.Windows.Forms.Padding();
this.btnCancel.Name = "btnCancel";
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.btnCancel.RectWidth = ;
this.btnCancel.Size = new System.Drawing.Size(, );
this.btnCancel.TabIndex = ;
this.btnCancel.TabStop = false;
this.btnCancel.TipsText = "";
this.btnCancel.BtnClick += new System.EventHandler(this.btnCancel_BtnClick);
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(, );
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(, );
this.panel3.TabIndex = ;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = ;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 1F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.ucSplitLine_V1, , );
this.tableLayoutPanel1.Controls.Add(this.btnOK, , );
this.tableLayoutPanel1.Controls.Add(this.btnCancel, , );
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tableLayoutPanel1.Location = new System.Drawing.Point(, );
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = ;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(, );
this.tableLayoutPanel1.TabIndex = ;
//
// ucSplitLine_V1
//
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ucSplitLine_V1.Location = new System.Drawing.Point(, );
this.ucSplitLine_V1.Margin = new System.Windows.Forms.Padding(, , , );
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Size = new System.Drawing.Size(, );
this.ucSplitLine_V1.TabIndex = ;
this.ucSplitLine_V1.TabStop = false;
//
// ucSplitLine_H2
//
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H2.Location = new System.Drawing.Point(, );
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
this.ucSplitLine_H2.Size = new System.Drawing.Size(, );
this.ucSplitLine_H2.TabIndex = ;
this.ucSplitLine_H2.TabStop = false;
//
// FrmWithOKCancel1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.panel3);
this.Controls.Add(this.ucSplitLine_H2);
this.Controls.Add(this.tableLayoutPanel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmWithOKCancel1";
this.Text = "FrmWithOKCancel";
this.VisibleChanged += new System.EventHandler(this.FrmWithOKCancel1_VisibleChanged);
this.Controls.SetChildIndex(this.tableLayoutPanel1, );
this.Controls.SetChildIndex(this.ucSplitLine_H2, );
this.Controls.SetChildIndex(this.panel3, );
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false); } #endregion private Controls.UCBtnExt btnOK;
private Controls.UCBtnExt btnCancel;
public System.Windows.Forms.Panel panel3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private Controls.UCSplitLine_H ucSplitLine_H2;
private Controls.UCSplitLine_V ucSplitLine_V1; }
}
用处及效果
最后的话
如果你喜欢的话,请到 https://gitee.com/kwwwvagaa/net_winform_custom_control 点个星 星吧
(二十五)c#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自定义控件-多输入窗体
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- Bootstrap <基础二十五>警告(Alerts)
警告(Alerts)以及 Bootstrap 所提供的用于警告的 class.警告(Alerts)向用户提供了一种定义消息样式的方式.它们为典型的用户操作提供了上下文信息反馈. 您可以为警告框添加一个 ...
- VMware vSphere 服务器虚拟化之二十五 桌面虚拟化之终端服务池
VMware vSphere 服务器虚拟化之二十五 桌面虚拟化之终端服务池 终端服务池是指由一台或多台微软终端服务器提供服务的桌面源组成的池.终端服务器桌面源可交付多个桌面.它具有以下特征: 1.终端 ...
- WCF技术剖析之二十五: 元数据(Metadata)架构体系全景展现[元数据描述篇]
原文:WCF技术剖析之二十五: 元数据(Metadata)架构体系全景展现[元数据描述篇] 在[WS标准篇]中我花了很大的篇幅介绍了WS-MEX以及与它相关的WS规范:WS-Policy.WS-Tra ...
- Bootstrap入门(二十五)JS插件2:过渡效果
Bootstrap入门(二十五)JS插件2:过渡效果 对于简单的过渡效果,只需将 transition.js 和其它 JS 文件一起引入即可.如果你使用的是编译(或压缩)版的bootstrap.js ...
- JAVA基础再回首(二十五)——Lock锁的使用、死锁问题、多线程生产者和消费者、线程池、匿名内部类使用多线程、定时器、面试题
JAVA基础再回首(二十五)--Lock锁的使用.死锁问题.多线程生产者和消费者.线程池.匿名内部类使用多线程.定时器.面试题 版权声明:转载必须注明本文转自程序猿杜鹏程的博客:http://blog ...
- JAVA之旅(二十五)——文件复制,字符流的缓冲区,BufferedWriter,BufferedReader,通过缓冲区复制文件,readLine工作原理,自定义readLine
JAVA之旅(二十五)--文件复制,字符流的缓冲区,BufferedWriter,BufferedReader,通过缓冲区复制文件,readLine工作原理,自定义readLine 我们继续IO上个篇 ...
随机推荐
- 第八章 Fisco Bcos 国密版本的部署、控制台搭建、合约的部署、sdk 调用
鉴于笔者以前各大博客教程都有很多人提问,早期建立一个技术交流群,里面技术体系可能比较杂,想了解相关区块链开发,技术提问,请加QQ群:538327407 参考资料 证书说明:https://mp.wei ...
- windows中实现python,redis服务自动重启(任务计划程序+bat脚本)
需求:银行电脑无法自动开机,只能 通过 应用相关服务每天自动重启的方式实现 服务更新并且防止服务假死,内存过大 等情况 相关工具:win10系统中,使用windows自带的任务计划程序 和 bat脚本 ...
- Spring中@value以及属性注入的学习
1.简单的Java配置 配置文件(jdbc.properties) jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://1 ...
- How to Read a Paper丨如何阅读一篇论文
这是我在看论文时无意刷到的博客推荐的一篇文章"How to Read a Paper",教你怎么样看论文.对于研究生来说,看论文基本是日常,一篇论文十多二十页,如何高效地读论文确实 ...
- 整型,布尔值,字符串详解,for语句
整型 -- 数字 用于比较和计算 + - * / // python 2 int --- long (长整型) /获取的是整数 Python3 int---整型 / 获取的浮点数 二进制 --- 就是 ...
- Unity3D 学习笔记一
安装Unity3D 环境 1 进入Unity3D 官网 http://unity3d.com/cn/ 找到获取 Unity 进去之后点击下载 2.下载完成之后进行安装,由于新的版本采用在线安装方式所以 ...
- CUDA编程学习笔记2
第二章 cuda代码写在.cu/.cuh里面 cuda 7.0 / 9.0开始,NVCC就支持c++11 / 14里面绝大部分的语言特性了. Dim3 __host__ __device__ dim3 ...
- 十三、asp.net中Repeater控件用法笔记
大家可能都对datagrid比较熟悉,但是如果在数据量大的时候,我们就得考虑使用 repeater作为我们的数据绑定控件了.Repeater控件与DataGrid (以及DataList)控件的主要区 ...
- jProfiler远程连接Linux监控jvm、tomcat运行状态
第一步.下载软件 官网地址:https://www.ej-technologies.com/download/jprofiler/files , Mac客户端 GUI界面 Linux服务端 第二步.安 ...
- 牛客第十场Rikka with Prefix Sum
由于其中的2操作非常多,我们就需要将其快速的更改,就会用到组合数的东西 其实自己手写一下就可以发现对于一个点增加的值在经过不断地前缀和累加过程中对于一点的贡献满足杨辉三角 所以我们就需要记录一下其中的 ...