(二十六)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,命名FrmWithOKCancel2,继承FrmWithTitle
代码不多,直接上全部代码
// 版权所有 黄正辉 交流群:568015492 QQ:623128629
// 文件名称:FrmWithOKCancel2.cs
// 创建日期:2019-08-15 16:05:21
// 功能描述:FrmWithOKCancel2
// 项目地址: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 FrmWithOKCancel2 : FrmWithTitle
{
public FrmWithOKCancel2()
{
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;
} private void FrmWithOKCancel2_VisibleChanged(object sender, EventArgs e)
{
}
}
}
namespace HZH_Controls.Forms
{
partial class FrmWithOKCancel2
{
/// <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(FrmWithOKCancel2));
this.panel2 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.btnOK = new HZH_Controls.Controls.UCBtnExt();
this.btnCancel = new HZH_Controls.Controls.UCBtnExt();
this.panel3 = new System.Windows.Forms.Panel();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.panel5.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel2
//
this.panel2.Controls.Add(this.panel4);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(, );
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(, );
this.panel2.TabIndex = ;
//
// panel4
//
this.panel4.Controls.Add(this.panel5);
this.panel4.Dock = System.Windows.Forms.DockStyle.Right;
this.panel4.Location = new System.Drawing.Point(, );
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(, );
this.panel4.TabIndex = ;
//
// panel5
//
this.panel5.Controls.Add(this.panel1);
this.panel5.Controls.Add(this.btnOK);
this.panel5.Controls.Add(this.btnCancel);
this.panel5.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel5.Location = new System.Drawing.Point(, );
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(, );
this.panel5.TabIndex = ;
//
// panel1
//
this.panel1.Controls.Add(this.ucSplitLine_V1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(, );
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(, , , );
this.panel1.Size = new System.Drawing.Size(, );
this.panel1.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.Right;
this.ucSplitLine_V1.Location = new System.Drawing.Point(, );
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Padding = new System.Windows.Forms.Padding(, , , );
this.ucSplitLine_V1.Size = new System.Drawing.Size(, );
this.ucSplitLine_V1.TabIndex = ;
this.ucSplitLine_V1.TabStop = false;
//
// 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.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
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.Right;
this.btnCancel.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
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 = ;
//
// 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;
//
// FrmWithOKCancel2
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.ucSplitLine_H2);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmWithOKCancel2";
this.Text = "FrmWithOKCancel2";
this.VisibleChanged += new System.EventHandler(this.FrmWithOKCancel2_VisibleChanged);
this.Controls.SetChildIndex(this.panel2, );
this.Controls.SetChildIndex(this.panel3, );
this.Controls.SetChildIndex(this.ucSplitLine_H2, );
this.panel2.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false); } #endregion private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel5;
private Controls.UCSplitLine_V ucSplitLine_V1;
private Controls.UCBtnExt btnOK;
private Controls.UCBtnExt btnCancel;
public System.Windows.Forms.Panel panel3;
public System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel1;
private Controls.UCSplitLine_H ucSplitLine_H2;
}
}
用处及效果
最后的话
如果你喜欢的话,请到 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 ...
- FreeSql (二十六)贪婪加载 Include、IncludeMany、Dto、ToList
贪婪加载顾名思议就是把所有要加载的东西一次性读取. 本节内容为了配合[延时加载]而诞生,贪婪加载和他本该在一起介绍,开发项目的过程中应该双管齐下,才能写出高质量的程序. Dto 映射查询 Select ...
- Bootstrap <基础二十六>进度条
Bootstrap 进度条.在本教程中,你将看到如何使用 Bootstrap 创建加载.重定向或动作状态的进度条. Bootstrap 进度条使用 CSS3 过渡和动画来获得该效果.Internet ...
- Web 前端开发人员和设计师必读精华文章【系列二十六】
<Web 前端开发精华文章推荐>2014年第5期(总第26期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各类能够提升网站用户体验的优秀 jQuery 插件,展示前沿的 HTML5 ...
- 二十六:Struts2 和 spring整合
二十六:Struts2 和 spring整合 将项目名称为day29_02_struts2Spring下的scr目录下的Struts.xml文件拷贝到新项目的scr目录下 在新项目的WebRoot-- ...
- 二十六、Jcreator使用初步
摘自http://blog.csdn.net/liujun13579/article/details/7751464 二十六.Jcreator使用初步 Jcreator是一个小巧灵活的Java开发工具 ...
- WCF技术剖析之二十六:如何导出WCF服务的元数据(Metadata)[扩展篇]
原文:WCF技术剖析之二十六:如何导出WCF服务的元数据(Metadata)[扩展篇] 通过<实现篇>对WSDL元素和终结点三要素的之间的匹配关系的介绍,我们知道了WSDL的Binding ...
随机推荐
- java网络爬虫,乱码问题终于完美解决
第一次写爬虫,被乱码问题困扰两天,试了很多方法都不可以,今天随便一试,居然好了. 在获取网页时创建了一个缓冲字节输入流,问题就在这个流上,添加标红代码即可 BufferedReader in = nu ...
- 《Predict Anchor Links across Social Networks via an Embedding Approach》阅读笔记
基本信息 文献:Predict Anchor Links across Social Networks via an Embedding Approach 时间:2016 期刊:IJCAI 引言 预测 ...
- 字符串翻转demo
1.利用char数组 public class stringfanzhaun { public static void main(String[] args) { String str="1 ...
- Java零基础个人学习路线总结
之前学习Java的时候走过一些弯路,一直想写一篇文章来总结下自己对自学Java的认识.趁着这次开通专栏的机会整理一篇文章,既可以巩固所学,也可以为后来境遇相同的人做个参考. 首先提出几个问题 Java ...
- Docker 环境下搭建nexus私服
一.安装docker 1.脚本安装 本机环境CentOS7,用户为root 下载脚本到工作目录 curl -fsSL https://get.docker.com -o get-docker.sh 执 ...
- 解密Kafka吞吐量高的原因
众所周知kafka的吞吐量比一般的消息队列要高,号称the fastest,那他是如何做到的,让我们从以下几个方面分析一下原因. 生产者(写入数据) 生产者(producer)是负责向Kafka提交数 ...
- hive show databases 添加条件
show databases like 'test012301' ; 通配符: show databases like 'a*';
- C语言编程入门之--第二章编译环境搭建
第二章 编译环境搭建 导读:C语言程序如何工作,首先需要编译链接成可执行文件,然后就可以运行在不同的环境中,这个“环境”的意思就是比如说,电脑,手机,路由器,蓝牙音箱等等智能设备中,其中编译器启到了关 ...
- springboot-权限控制shiro(二)
目录 1. 场景描述 2. 解决方案 1. 场景描述 (1)最近有点小忙,公司真实项目内容有点小多以及不想只介绍理论,就使用springboot单独部署了个shiro的demo项目,还是理论和实际项结 ...
- rocksdb编译步骤——Java、Golang、mac
如果不是必要不建议自己编译rocksdb,编译的过程比较耗时费力.现在已经有很多编译好的文件可供使用. Java <!-- https://mvnrepository.com/artifact/ ...