官网

http://www.hzhcontrols.com

前提

入行已经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

准备工作

GDI+需要有一点了解,不知道的可以百度瞅瞅

开始

添加一个用户控件,命名UCSwitch

添加一个枚举用以控制样式

 public enum SwitchType
{
/// <summary>
/// 椭圆
/// </summary>
Ellipse,
/// <summary>
/// 四边形
/// </summary>
Quadrilateral,
/// <summary>
/// 横线
/// </summary>
Line
}

添加属性

   [Description("选中改变事件"), Category("自定义")]
public event EventHandler CheckedChanged;
private Color m_trueColor = Color.FromArgb(, , ); [Description("选中时颜色"), Category("自定义")]
public Color TrueColor
{
get { return m_trueColor; }
set
{
m_trueColor = value;
Refresh();
}
} private Color m_falseColor = Color.FromArgb(, , ); [Description("没有选中时颜色"), Category("自定义")]
public Color FalseColor
{
get { return m_falseColor; }
set
{
m_falseColor = value;
Refresh();
}
} private bool m_checked; [Description("是否选中"), Category("自定义")]
public bool Checked
{
get { return m_checked; }
set
{
m_checked = value;
Refresh();
if (CheckedChanged != null)
{
CheckedChanged(this, null);
}
}
} private string[] m_texts; [Description("文本值,当选中或没有选中时显示,必须是长度为2的数组"), Category("自定义")]
public string[] Texts
{
get { return m_texts; }
set
{
m_texts = value;
Refresh();
}
}
private SwitchType m_switchType = SwitchType.Ellipse; [Description("显示类型"), Category("自定义")]
public SwitchType SwitchType
{
get { return m_switchType; }
set
{
m_switchType = value;
Refresh();
}
} public override Font Font
{
get
{
return base.Font;
}
set
{
base.Font = value;
Refresh();
}
}

重绘

  protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
var g = e.Graphics;
g.SetGDIHigh();
if (m_switchType == HZH_Controls.Controls.SwitchType.Ellipse)
{
var fillColor = m_checked ? m_trueColor : m_falseColor;
GraphicsPath path = new GraphicsPath();
path.AddLine(new Point(this.Height / , ), new Point(this.Width - this.Height / , ));
path.AddArc(new Rectangle(this.Width - this.Height - , , this.Height - , this.Height - ), -, );
path.AddLine(new Point(this.Width - this.Height / , this.Height - ), new Point(this.Height / , this.Height - ));
path.AddArc(new Rectangle(, , this.Height - , this.Height - ), , );
g.FillPath(new SolidBrush(fillColor), path); string strText = string.Empty;
if (m_texts != null && m_texts.Length == )
{
if (m_checked)
{
strText = m_texts[];
}
else
{
strText = m_texts[];
}
} if (m_checked)
{
g.FillEllipse(Brushes.White, new Rectangle(this.Width - this.Height - + , + , this.Height - - , this.Height - - ));
if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle((this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point((this.Height - - ) / , intTextY));
}
}
else
{
g.FillEllipse(Brushes.White, new Rectangle( + , + , this.Height - - , this.Height - - ));
if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / - (int)sizeF.Width / , intTextY));
}
}
}
else if (m_switchType == HZH_Controls.Controls.SwitchType.Quadrilateral)
{
var fillColor = m_checked ? m_trueColor : m_falseColor;
GraphicsPath path = new GraphicsPath();
int intRadius = ;
path.AddArc(, , intRadius, intRadius, 180f, 90f);
path.AddArc(this.Width - intRadius - , , intRadius, intRadius, 270f, 90f);
path.AddArc(this.Width - intRadius - , this.Height - intRadius - , intRadius, intRadius, 0f, 90f);
path.AddArc(, this.Height - intRadius - , intRadius, intRadius, 90f, 90f); g.FillPath(new SolidBrush(fillColor), path); string strText = string.Empty;
if (m_texts != null && m_texts.Length == )
{
if (m_checked)
{
strText = m_texts[];
}
else
{
strText = m_texts[];
}
} if (m_checked)
{
GraphicsPath path2 = new GraphicsPath();
path2.AddArc(this.Width - this.Height - + , + , intRadius, intRadius, 180f, 90f);
path2.AddArc(this.Width - - - intRadius, + , intRadius, intRadius, 270f, 90f);
path2.AddArc(this.Width - - - intRadius, this.Height - - intRadius - , intRadius, intRadius, 0f, 90f);
path2.AddArc(this.Width - this.Height - + , this.Height - - intRadius - , intRadius, intRadius, 90f, 90f);
g.FillPath(Brushes.White, path2); if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle((this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point((this.Height - - ) / , intTextY));
}
}
else
{
GraphicsPath path2 = new GraphicsPath();
path2.AddArc( + , + , intRadius, intRadius, 180f, 90f);
path2.AddArc(this.Height - - intRadius, + , intRadius, intRadius, 270f, 90f);
path2.AddArc(this.Height - - intRadius, this.Height - - intRadius - , intRadius, intRadius, 0f, 90f);
path2.AddArc( + , this.Height - - intRadius - , intRadius, intRadius, 90f, 90f);
g.FillPath(Brushes.White, path2); //g.FillEllipse(Brushes.White, new Rectangle(1 + 2, 1 + 2, this.Height - 2 - 4, this.Height - 2 - 4));
if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / - (int)sizeF.Width / , intTextY));
}
}
}
else
{
var fillColor = m_checked ? m_trueColor : m_falseColor;
int intLineHeight = (this.Height - - ) / ; GraphicsPath path = new GraphicsPath();
path.AddLine(new Point(this.Height / , (this.Height - intLineHeight) / ), new Point(this.Width - this.Height / , (this.Height - intLineHeight) / ));
path.AddArc(new Rectangle(this.Width - this.Height / - intLineHeight - , (this.Height - intLineHeight) / , intLineHeight, intLineHeight), -, );
path.AddLine(new Point(this.Width - this.Height / , (this.Height - intLineHeight) / + intLineHeight), new Point(this.Width - this.Height / , (this.Height - intLineHeight) / + intLineHeight));
path.AddArc(new Rectangle(this.Height / , (this.Height - intLineHeight) / , intLineHeight, intLineHeight), , );
g.FillPath(new SolidBrush(fillColor), path); if (m_checked)
{
g.FillEllipse(new SolidBrush(fillColor), new Rectangle(this.Width - this.Height - + , + , this.Height - - , this.Height - - ));
g.FillEllipse(Brushes.White, new Rectangle(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / - , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
g.FillEllipse(new SolidBrush(fillColor), new Rectangle( + , + , this.Height - - , this.Height - - ));
g.FillEllipse(Brushes.White, new Rectangle((this.Height - - ) / - ((this.Height - - ) / ) / + , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
}
}

处理一下点击事件

  void UCSwitch_MouseDown(object sender, MouseEventArgs e)
{
Checked = !Checked;
}

完整代码

 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;
using System.Drawing.Drawing2D; namespace HZH_Controls.Controls
{
[DefaultEvent("CheckedChanged")]
public partial class UCSwitch : UserControl
{
[Description("选中改变事件"), Category("自定义")]
public event EventHandler CheckedChanged;
private Color m_trueColor = Color.FromArgb(, , ); [Description("选中时颜色"), Category("自定义")]
public Color TrueColor
{
get { return m_trueColor; }
set
{
m_trueColor = value;
Refresh();
}
} private Color m_falseColor = Color.FromArgb(, , ); [Description("没有选中时颜色"), Category("自定义")]
public Color FalseColor
{
get { return m_falseColor; }
set
{
m_falseColor = value;
Refresh();
}
} private bool m_checked; [Description("是否选中"), Category("自定义")]
public bool Checked
{
get { return m_checked; }
set
{
m_checked = value;
Refresh();
if (CheckedChanged != null)
{
CheckedChanged(this, null);
}
}
} private string[] m_texts; [Description("文本值,当选中或没有选中时显示,必须是长度为2的数组"), Category("自定义")]
public string[] Texts
{
get { return m_texts; }
set
{
m_texts = value;
Refresh();
}
}
private SwitchType m_switchType = SwitchType.Ellipse; [Description("显示类型"), Category("自定义")]
public SwitchType SwitchType
{
get { return m_switchType; }
set
{
m_switchType = value;
Refresh();
}
} public override Font Font
{
get
{
return base.Font;
}
set
{
base.Font = value;
Refresh();
}
} public UCSwitch()
{
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.Selectable, true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.MouseDown += UCSwitch_MouseDown;
} void UCSwitch_MouseDown(object sender, MouseEventArgs e)
{
Checked = !Checked;
} protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
var g = e.Graphics;
g.SetGDIHigh();
if (m_switchType == HZH_Controls.Controls.SwitchType.Ellipse)
{
var fillColor = m_checked ? m_trueColor : m_falseColor;
GraphicsPath path = new GraphicsPath();
path.AddLine(new Point(this.Height / , ), new Point(this.Width - this.Height / , ));
path.AddArc(new Rectangle(this.Width - this.Height - , , this.Height - , this.Height - ), -, );
path.AddLine(new Point(this.Width - this.Height / , this.Height - ), new Point(this.Height / , this.Height - ));
path.AddArc(new Rectangle(, , this.Height - , this.Height - ), , );
g.FillPath(new SolidBrush(fillColor), path); string strText = string.Empty;
if (m_texts != null && m_texts.Length == )
{
if (m_checked)
{
strText = m_texts[];
}
else
{
strText = m_texts[];
}
} if (m_checked)
{
g.FillEllipse(Brushes.White, new Rectangle(this.Width - this.Height - + , + , this.Height - - , this.Height - - ));
if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle((this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point((this.Height - - ) / , intTextY));
}
}
else
{
g.FillEllipse(Brushes.White, new Rectangle( + , + , this.Height - - , this.Height - - ));
if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / - (int)sizeF.Width / , intTextY));
}
}
}
else if (m_switchType == HZH_Controls.Controls.SwitchType.Quadrilateral)
{
var fillColor = m_checked ? m_trueColor : m_falseColor;
GraphicsPath path = new GraphicsPath();
int intRadius = ;
path.AddArc(, , intRadius, intRadius, 180f, 90f);
path.AddArc(this.Width - intRadius - , , intRadius, intRadius, 270f, 90f);
path.AddArc(this.Width - intRadius - , this.Height - intRadius - , intRadius, intRadius, 0f, 90f);
path.AddArc(, this.Height - intRadius - , intRadius, intRadius, 90f, 90f); g.FillPath(new SolidBrush(fillColor), path); string strText = string.Empty;
if (m_texts != null && m_texts.Length == )
{
if (m_checked)
{
strText = m_texts[];
}
else
{
strText = m_texts[];
}
} if (m_checked)
{
GraphicsPath path2 = new GraphicsPath();
path2.AddArc(this.Width - this.Height - + , + , intRadius, intRadius, 180f, 90f);
path2.AddArc(this.Width - - - intRadius, + , intRadius, intRadius, 270f, 90f);
path2.AddArc(this.Width - - - intRadius, this.Height - - intRadius - , intRadius, intRadius, 0f, 90f);
path2.AddArc(this.Width - this.Height - + , this.Height - - intRadius - , intRadius, intRadius, 90f, 90f);
g.FillPath(Brushes.White, path2); if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle((this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point((this.Height - - ) / , intTextY));
}
}
else
{
GraphicsPath path2 = new GraphicsPath();
path2.AddArc( + , + , intRadius, intRadius, 180f, 90f);
path2.AddArc(this.Height - - intRadius, + , intRadius, intRadius, 270f, 90f);
path2.AddArc(this.Height - - intRadius, this.Height - - intRadius - , intRadius, intRadius, 0f, 90f);
path2.AddArc( + , this.Height - - intRadius - , intRadius, intRadius, 90f, 90f);
g.FillPath(Brushes.White, path2); //g.FillEllipse(Brushes.White, new Rectangle(1 + 2, 1 + 2, this.Height - 2 - 4, this.Height - 2 - 4));
if (string.IsNullOrEmpty(strText))
{
g.DrawEllipse(new Pen(Color.White, ), new Rectangle(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / + ;
g.DrawString(strText, Font, Brushes.White, new Point(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / - (int)sizeF.Width / , intTextY));
}
}
}
else
{
var fillColor = m_checked ? m_trueColor : m_falseColor;
int intLineHeight = (this.Height - - ) / ; GraphicsPath path = new GraphicsPath();
path.AddLine(new Point(this.Height / , (this.Height - intLineHeight) / ), new Point(this.Width - this.Height / , (this.Height - intLineHeight) / ));
path.AddArc(new Rectangle(this.Width - this.Height / - intLineHeight - , (this.Height - intLineHeight) / , intLineHeight, intLineHeight), -, );
path.AddLine(new Point(this.Width - this.Height / , (this.Height - intLineHeight) / + intLineHeight), new Point(this.Width - this.Height / , (this.Height - intLineHeight) / + intLineHeight));
path.AddArc(new Rectangle(this.Height / , (this.Height - intLineHeight) / , intLineHeight, intLineHeight), , );
g.FillPath(new SolidBrush(fillColor), path); if (m_checked)
{
g.FillEllipse(new SolidBrush(fillColor), new Rectangle(this.Width - this.Height - + , + , this.Height - - , this.Height - - ));
g.FillEllipse(Brushes.White, new Rectangle(this.Width - - (this.Height - - ) / - ((this.Height - - ) / ) / - , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
else
{
g.FillEllipse(new SolidBrush(fillColor), new Rectangle( + , + , this.Height - - , this.Height - - ));
g.FillEllipse(Brushes.White, new Rectangle((this.Height - - ) / - ((this.Height - - ) / ) / + , (this.Height - - (this.Height - - ) / ) / + , (this.Height - - ) / , (this.Height - - ) / ));
}
}
} } public enum SwitchType
{
/// <summary>
/// 椭圆
/// </summary>
Ellipse,
/// <summary>
/// 四边形
/// </summary>
Quadrilateral,
/// <summary>
/// 横线
/// </summary>
Line
}
}
 namespace HZH_Controls.Controls
{
partial class UCSwitch
{
/// <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.SuspendLayout();
//
// UCSwitch
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent;
this.Name = "UCSwitch";
this.Size = new System.Drawing.Size(, );
this.ResumeLayout(false); } #endregion
}
}

用处及效果

最后的话

如果你喜欢的话,请到 https://gitee.com/kwwwvagaa/net_winform_custom_control 点个星 星吧

(四十)c#Winform自定义控件-开关-HZHControls的更多相关文章

  1. (四十四)c#Winform自定义控件-水波-HZHControls

    官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...

  2. (二十四)c#Winform自定义控件-单标题窗体

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...

  3. (四)c#Winform自定义控件-选择按钮组

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...

  4. (十四)c#Winform自定义控件-键盘(一)

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...

  5. (五十四)c#Winform自定义控件-仪表盘

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...

  6. (六十四)c#Winform自定义控件-温度计(工业)

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...

  7. (七十四)c#Winform自定义控件-金字塔图表

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...

  8. (八十四)c#Winform自定义控件-导航菜单(类Office菜单)

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...

  9. (四十六)c#Winform自定义控件-水波进度条-HZHControls

    官网 http://www.hzhcontrols.com 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kww ...

随机推荐

  1. 集群环境下,你不得不注意的ASP.NET Core Data Protection 机制

    引言 最近线上环境遇到一个问题,就是ASP.NET Core Web应用在单个容器使用正常,扩展多个容器无法访问的问题.查看容器日志,发现以下异常: System.Security.Cryptogra ...

  2. 服务器端Mysql常用操作

    原文内容来自于LZ(楼主)的印象笔记,如出现排版异常或图片丢失等问题,可查看当前链接:https://app.yinxiang.com/shard/s17/nl/19391737/f7463513-5 ...

  3. 调用高德API,通过输入的地址,如省份、市、区获取经纬度 ,通过输入的经纬度,获取区域详情

    一.pom <?xml version="1.0" encoding="UTF-8"?><projectxmlns="http:// ...

  4. C# HttpClient以multipart/form-data形式 提交文件和其它参数

    调用文件接口,需要一个上传文件和一个Region参数,参考调用实例 public async Task<WebApiResult> UploadFile(UploadFileModel i ...

  5. Gradle-任务

    任务结果标签 当 Gradle 执行一个任务时,它会在控制台和 Tooling API 根据任务结果给任务打标签. 这些标签是根据任务是否有操作,是否应该执行操作,是否执行了操作以及这些操作做了哪些改 ...

  6. Linux selinux 规则导致audit拒绝

    Linux selinux 规则导致audit拒绝 转载注明来源: 本文链接 来自osnosn的博客,写于 2019-09-26. 查看 audit2why -d audit2allow 这两个命令. ...

  7. Android——application全局类的使用

    目录 1.概述 2.Application基类 3.自定义Application类 4.Application的生命周期 5.Application对象的回调函数 6.Application对象的作用 ...

  8. HTTP与WWW服务

    1.查看本地DNS缓存 ipconfig /displaydns #显示DNS缓存内容ipconfig /flushdns #清除DNS缓存 2.查看本地hosts. C:\Windows\Syste ...

  9. antdesign的input增加自定义校验规则

    rules: [ {required: true, message: '请输入姓名'}, {max: 16, message: '姓名过长'}, { validator: (rule, val, ca ...

  10. Hive DDL、DML操作

    • 一.DDL操作(数据定义语言)包括:Create.Alter.Show.Drop等. • create database- 创建新数据库 • alter database - 修改数据库 • dr ...