官网

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

准备工作

前面介绍了那么多控件(虽然重要的文本框还没有出现),终于轮到窗体上场了

首先我们需要一个基类窗体,所有的窗体都将继承基类窗体

基类窗体需要实现哪些功能呢?

  1. 圆角
  2. 边框
  3. 热键
  4. 蒙版

开始

添加一个Form,命名FrmBase

写上一些属性

  [Description("定义的热键列表"), Category("自定义")]
public Dictionary<int, string> HotKeys { get; set; }
public delegate bool HotKeyEventHandler(string strHotKey);
/// <summary>
/// 热键事件
/// </summary>
[Description("热键事件"), Category("自定义")]
public event HotKeyEventHandler HotKeyDown;
#region 字段属性 /// <summary>
/// 失去焦点关闭
/// </summary>
bool _isLoseFocusClose = false;
/// <summary>
/// 是否重绘边框样式
/// </summary>
private bool _redraw = false;
/// <summary>
/// 是否显示圆角
/// </summary>
private bool _isShowRegion = false;
/// <summary>
/// 边圆角大小
/// </summary>
private int _regionRadius = ;
/// <summary>
/// 边框颜色
/// </summary>
private Color _borderStyleColor;
/// <summary>
/// 边框宽度
/// </summary>
private int _borderStyleSize;
/// <summary>
/// 边框样式
/// </summary>
private ButtonBorderStyle _borderStyleType;
/// <summary>
/// 是否显示模态
/// </summary>
private bool _isShowMaskDialog = false;
/// <summary>
/// 蒙版窗体
/// </summary>
//private FrmTransparent _frmTransparent = null;
/// <summary>
/// 是否显示蒙版窗体
/// </summary>
[Description("是否显示蒙版窗体")]
public bool IsShowMaskDialog
{
get
{
return this._isShowMaskDialog;
}
set
{
this._isShowMaskDialog = value;
}
}
/// <summary>
/// 边框宽度
/// </summary>
[Description("边框宽度")]
public int BorderStyleSize
{
get
{
return this._borderStyleSize;
}
set
{
this._borderStyleSize = value;
}
}
/// <summary>
/// 边框颜色
/// </summary>
[Description("边框颜色")]
public Color BorderStyleColor
{
get
{
return this._borderStyleColor;
}
set
{
this._borderStyleColor = value;
}
}
/// <summary>
/// 边框样式
/// </summary>
[Description("边框样式")]
public ButtonBorderStyle BorderStyleType
{
get
{
return this._borderStyleType;
}
set
{
this._borderStyleType = value;
}
}
/// <summary>
/// 边框圆角
/// </summary>
[Description("边框圆角")]
public int RegionRadius
{
get
{
return this._regionRadius;
}
set
{
this._regionRadius = value;
}
}
/// <summary>
/// 是否显示自定义绘制内容
/// </summary>
[Description("是否显示自定义绘制内容")]
public bool IsShowRegion
{
get
{
return this._isShowRegion;
}
set
{
this._isShowRegion = value;
}
}
/// <summary>
/// 是否显示重绘边框
/// </summary>
[Description("是否显示重绘边框")]
public bool Redraw
{
get
{
return this._redraw;
}
set
{
this._redraw = value;
}
} private bool _isFullSize = true;
/// <summary>
/// 是否全屏
/// </summary>
[Description("是否全屏")]
public bool IsFullSize
{
get { return _isFullSize; }
set { _isFullSize = value; }
}
/// <summary>
/// 失去焦点自动关闭
/// </summary>
[Description("失去焦点自动关闭")]
public bool IsLoseFocusClose
{
get
{
return this._isLoseFocusClose;
}
set
{
this._isLoseFocusClose = value;
}
}
#endregion private bool IsDesingMode
{
get
{
bool ReturnFlag = false;
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
ReturnFlag = true;
else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
ReturnFlag = true;
return ReturnFlag;
}
}

快捷键处理

 /// <summary>
/// 快捷键
/// </summary>
/// <param name="msg"></param>
/// <param name="keyData"></param>
/// <returns></returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
int num = ;
int num2 = ;
bool result;
if (msg.Msg == num | msg.Msg == num2)
{
if (keyData == (Keys))
{
result = true;
return result;
}
if (keyData != Keys.Enter)
{
if (keyData == Keys.Escape)
{
this.DoEsc();
}
}
else
{
this.DoEnter();
}
}
result = false;
if (result)
return result;
else
return base.ProcessCmdKey(ref msg, keyData);
}
 protected void FrmBase_KeyDown(object sender, KeyEventArgs e)
{
if (HotKeyDown != null && HotKeys != null)
{
bool blnCtrl = false;
bool blnAlt = false;
bool blnShift = false;
if (e.Control)
blnCtrl = true;
if (e.Alt)
blnAlt = true;
if (e.Shift)
blnShift = true;
if (HotKeys.ContainsKey(e.KeyValue))
{
string strKey = string.Empty;
if (blnCtrl)
{
strKey += "Ctrl+";
}
if (blnAlt)
{
strKey += "Alt+";
}
if (blnShift)
{
strKey += "Shift+";
}
strKey += HotKeys[e.KeyValue]; if (HotKeyDown(strKey))
{
e.Handled = true;
e.SuppressKeyPress = true;
}
}
}
}

重绘

  /// <summary>
/// 重绘事件
/// </summary>
/// <param name="e"></param>
protected override void OnPaint(PaintEventArgs e)
{
if (this._isShowRegion)
{
this.SetWindowRegion();
}
base.OnPaint(e);
if (this._redraw)
{
ControlPaint.DrawBorder(e.Graphics, base.ClientRectangle, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType);
}
}
/// <summary>
/// 设置重绘区域
/// </summary>
public void SetWindowRegion()
{
GraphicsPath path = new GraphicsPath();
Rectangle rect = new Rectangle(-, -, base.Width + , base.Height);
path = this.GetRoundedRectPath(rect, this._regionRadius);
base.Region = new Region(path);
}
/// <summary>
/// 获取重绘区域
/// </summary>
/// <param name="rect"></param>
/// <param name="radius"></param>
/// <returns></returns>
private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
{
Rectangle rect2 = new Rectangle(rect.Location, new Size(radius, radius));
GraphicsPath graphicsPath = new GraphicsPath();
graphicsPath.AddArc(rect2, 180f, 90f);
rect2.X = rect.Right - radius;
graphicsPath.AddArc(rect2, 270f, 90f);
rect2.Y = rect.Bottom - radius;
rect2.Width += ;
rect2.Height += ;
graphicsPath.AddArc(rect2, 360f, 90f);
rect2.X = rect.Left;
graphicsPath.AddArc(rect2, 90f, 90f);
graphicsPath.CloseFigure();
return graphicsPath;
}

还有为了点击窗体外区域关闭的钩子功能

  void FrmBase_FormClosing(object sender, FormClosingEventArgs e)
{
if (_isLoseFocusClose)
{
MouseHook.OnMouseActivity -= hook_OnMouseActivity;
}
} private void FrmBase_Load(object sender, EventArgs e)
{
if (!IsDesingMode)
{
if (_isFullSize)
SetFullSize();
}
if (_isLoseFocusClose)
{
MouseHook.OnMouseActivity += hook_OnMouseActivity;
}
} #endregion #region 方法区 void hook_OnMouseActivity(object sender, MouseEventArgs e)
{
try
{
if (this._isLoseFocusClose && e.Clicks > )
{
if (e.Button == System.Windows.Forms.MouseButtons.Left || e.Button == System.Windows.Forms.MouseButtons.Right)
{
if (!this.IsDisposed)
{
if (!this.ClientRectangle.Contains(this.PointToClient(e.Location)))
{
base.Close();
}
}
}
}
}
catch { }
}

为了实现蒙版,覆盖ShowDialog函数

 public new DialogResult ShowDialog(IWin32Window owner)
{
try
{
if (this._isShowMaskDialog && owner != null)
{
var frmOwner = (Control)owner;
FrmTransparent _frmTransparent = new FrmTransparent();
_frmTransparent.Width = frmOwner.Width;
_frmTransparent.Height = frmOwner.Height;
Point location = frmOwner.PointToScreen(new Point(, ));
_frmTransparent.Location = location;
_frmTransparent.frmchild = this;
_frmTransparent.IsShowMaskDialog = false;
return _frmTransparent.ShowDialog(owner);
}
else
{
return base.ShowDialog(owner);
}
}
catch (NullReferenceException)
{
return System.Windows.Forms.DialogResult.None;
}
} public new DialogResult ShowDialog()
{
return base.ShowDialog();
}

最后看下完整代码

 // 版权所有  黄正辉  交流群:568015492   QQ:623128629
// 文件名称:FrmBase.cs
// 创建日期:2019-08-15 16:04:31
// 功能描述:FrmBase
// 项目地址: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.Drawing.Drawing2D;
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 FrmBase : Form
{
[Description("定义的热键列表"), Category("自定义")]
public Dictionary<int, string> HotKeys { get; set; }
public delegate bool HotKeyEventHandler(string strHotKey);
/// <summary>
/// 热键事件
/// </summary>
[Description("热键事件"), Category("自定义")]
public event HotKeyEventHandler HotKeyDown;
#region 字段属性 /// <summary>
/// 失去焦点关闭
/// </summary>
bool _isLoseFocusClose = false;
/// <summary>
/// 是否重绘边框样式
/// </summary>
private bool _redraw = false;
/// <summary>
/// 是否显示圆角
/// </summary>
private bool _isShowRegion = false;
/// <summary>
/// 边圆角大小
/// </summary>
private int _regionRadius = ;
/// <summary>
/// 边框颜色
/// </summary>
private Color _borderStyleColor;
/// <summary>
/// 边框宽度
/// </summary>
private int _borderStyleSize;
/// <summary>
/// 边框样式
/// </summary>
private ButtonBorderStyle _borderStyleType;
/// <summary>
/// 是否显示模态
/// </summary>
private bool _isShowMaskDialog = false;
/// <summary>
/// 蒙版窗体
/// </summary>
//private FrmTransparent _frmTransparent = null;
/// <summary>
/// 是否显示蒙版窗体
/// </summary>
[Description("是否显示蒙版窗体")]
public bool IsShowMaskDialog
{
get
{
return this._isShowMaskDialog;
}
set
{
this._isShowMaskDialog = value;
}
}
/// <summary>
/// 边框宽度
/// </summary>
[Description("边框宽度")]
public int BorderStyleSize
{
get
{
return this._borderStyleSize;
}
set
{
this._borderStyleSize = value;
}
}
/// <summary>
/// 边框颜色
/// </summary>
[Description("边框颜色")]
public Color BorderStyleColor
{
get
{
return this._borderStyleColor;
}
set
{
this._borderStyleColor = value;
}
}
/// <summary>
/// 边框样式
/// </summary>
[Description("边框样式")]
public ButtonBorderStyle BorderStyleType
{
get
{
return this._borderStyleType;
}
set
{
this._borderStyleType = value;
}
}
/// <summary>
/// 边框圆角
/// </summary>
[Description("边框圆角")]
public int RegionRadius
{
get
{
return this._regionRadius;
}
set
{
this._regionRadius = value;
}
}
/// <summary>
/// 是否显示自定义绘制内容
/// </summary>
[Description("是否显示自定义绘制内容")]
public bool IsShowRegion
{
get
{
return this._isShowRegion;
}
set
{
this._isShowRegion = value;
}
}
/// <summary>
/// 是否显示重绘边框
/// </summary>
[Description("是否显示重绘边框")]
public bool Redraw
{
get
{
return this._redraw;
}
set
{
this._redraw = value;
}
} private bool _isFullSize = true;
/// <summary>
/// 是否全屏
/// </summary>
[Description("是否全屏")]
public bool IsFullSize
{
get { return _isFullSize; }
set { _isFullSize = value; }
}
/// <summary>
/// 失去焦点自动关闭
/// </summary>
[Description("失去焦点自动关闭")]
public bool IsLoseFocusClose
{
get
{
return this._isLoseFocusClose;
}
set
{
this._isLoseFocusClose = value;
}
}
#endregion private bool IsDesingMode
{
get
{
bool ReturnFlag = false;
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
ReturnFlag = true;
else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
ReturnFlag = true;
return ReturnFlag;
}
} #region 初始化
public FrmBase()
{
InitializeComponent();
base.SetStyle(ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
base.SetStyle(ControlStyles.DoubleBuffer, true);
//base.HandleCreated += new EventHandler(this.FrmBase_HandleCreated);
//base.HandleDestroyed += new EventHandler(this.FrmBase_HandleDestroyed);
this.KeyDown += FrmBase_KeyDown;
this.FormClosing += FrmBase_FormClosing;
} void FrmBase_FormClosing(object sender, FormClosingEventArgs e)
{
if (_isLoseFocusClose)
{
MouseHook.OnMouseActivity -= hook_OnMouseActivity;
}
} private void FrmBase_Load(object sender, EventArgs e)
{
if (!IsDesingMode)
{
if (_isFullSize)
SetFullSize();
}
if (_isLoseFocusClose)
{
MouseHook.OnMouseActivity += hook_OnMouseActivity;
}
} #endregion #region 方法区 void hook_OnMouseActivity(object sender, MouseEventArgs e)
{
try
{
if (this._isLoseFocusClose && e.Clicks > )
{
if (e.Button == System.Windows.Forms.MouseButtons.Left || e.Button == System.Windows.Forms.MouseButtons.Right)
{
if (!this.IsDisposed)
{
if (!this.ClientRectangle.Contains(this.PointToClient(e.Location)))
{
base.Close();
}
}
}
}
}
catch { }
} /// <summary>
/// 全屏
/// </summary>
public void SetFullSize()
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
protected virtual void DoEsc()
{
base.Close();
} protected virtual void DoEnter()
{
} /// <summary>
/// 设置重绘区域
/// </summary>
public void SetWindowRegion()
{
GraphicsPath path = new GraphicsPath();
Rectangle rect = new Rectangle(-, -, base.Width + , base.Height);
path = this.GetRoundedRectPath(rect, this._regionRadius);
base.Region = new Region(path);
}
/// <summary>
/// 获取重绘区域
/// </summary>
/// <param name="rect"></param>
/// <param name="radius"></param>
/// <returns></returns>
private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
{
Rectangle rect2 = new Rectangle(rect.Location, new Size(radius, radius));
GraphicsPath graphicsPath = new GraphicsPath();
graphicsPath.AddArc(rect2, 180f, 90f);
rect2.X = rect.Right - radius;
graphicsPath.AddArc(rect2, 270f, 90f);
rect2.Y = rect.Bottom - radius;
rect2.Width += ;
rect2.Height += ;
graphicsPath.AddArc(rect2, 360f, 90f);
rect2.X = rect.Left;
graphicsPath.AddArc(rect2, 90f, 90f);
graphicsPath.CloseFigure();
return graphicsPath;
} public new DialogResult ShowDialog(IWin32Window owner)
{
try
{
if (this._isShowMaskDialog && owner != null)
{
var frmOwner = (Control)owner;
FrmTransparent _frmTransparent = new FrmTransparent();
_frmTransparent.Width = frmOwner.Width;
_frmTransparent.Height = frmOwner.Height;
Point location = frmOwner.PointToScreen(new Point(, ));
_frmTransparent.Location = location;
_frmTransparent.frmchild = this;
_frmTransparent.IsShowMaskDialog = false;
return _frmTransparent.ShowDialog(owner);
}
else
{
return base.ShowDialog(owner);
}
}
catch (NullReferenceException)
{
return System.Windows.Forms.DialogResult.None;
}
} public new DialogResult ShowDialog()
{
return base.ShowDialog();
}
#endregion #region 事件区 /// <summary>
/// 关闭时发生
/// </summary>
/// <param name="e"></param>
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
if (base.Owner != null && base.Owner is FrmTransparent)
{
(base.Owner as FrmTransparent).Close();
}
} /// <summary>
/// 快捷键
/// </summary>
/// <param name="msg"></param>
/// <param name="keyData"></param>
/// <returns></returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
int num = ;
int num2 = ;
bool result;
if (msg.Msg == num | msg.Msg == num2)
{
if (keyData == (Keys))
{
result = true;
return result;
}
if (keyData != Keys.Enter)
{
if (keyData == Keys.Escape)
{
this.DoEsc();
}
}
else
{
this.DoEnter();
}
}
result = false;
if (result)
return result;
else
return base.ProcessCmdKey(ref msg, keyData);
} protected void FrmBase_KeyDown(object sender, KeyEventArgs e)
{
if (HotKeyDown != null && HotKeys != null)
{
bool blnCtrl = false;
bool blnAlt = false;
bool blnShift = false;
if (e.Control)
blnCtrl = true;
if (e.Alt)
blnAlt = true;
if (e.Shift)
blnShift = true;
if (HotKeys.ContainsKey(e.KeyValue))
{
string strKey = string.Empty;
if (blnCtrl)
{
strKey += "Ctrl+";
}
if (blnAlt)
{
strKey += "Alt+";
}
if (blnShift)
{
strKey += "Shift+";
}
strKey += HotKeys[e.KeyValue]; if (HotKeyDown(strKey))
{
e.Handled = true;
e.SuppressKeyPress = true;
}
}
}
} /// <summary>
/// 重绘事件
/// </summary>
/// <param name="e"></param>
protected override void OnPaint(PaintEventArgs e)
{
if (this._isShowRegion)
{
this.SetWindowRegion();
}
base.OnPaint(e);
if (this._redraw)
{
ControlPaint.DrawBorder(e.Graphics, base.ClientRectangle, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType);
}
}
#endregion }
}
 namespace HZH_Controls.Forms
{
partial class FrmBase
{
/// <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(FrmBase));
this.SuspendLayout();
//
// FrmBase
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.ClientSize = new System.Drawing.Size(, );
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(, , , );
this.Name = "FrmBase";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmBase";
this.Load += new System.EventHandler(this.FrmBase_Load);
this.ResumeLayout(false); } #endregion
}
}

设计效果就是这样的

用处及效果

一般来说,这个基类窗体不直接使用,不过你高兴用的话 也是可以的 ,比如设计个圆角窗体什么的

最后的话

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

(十七)c#Winform自定义控件-基类窗体的更多相关文章

  1. (一)c#Winform自定义控件-基类控件

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

  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线程基类

    在CS模式开发中一般我们需要用到大量的线程来处理比较耗时的操作,以防止界面假死带来不好的体验效果,下面我将我定义的线程基类给大家参考下,如有问题欢迎指正. 基类代码 #region 方法有返回值 // ...

  5. (二十)c#Winform自定义控件-有后退的窗体

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

  6. (二十二)c#Winform自定义控件-半透明窗体

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

  7. (二十三)c#Winform自定义控件-等待窗体

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

  8. (七十三)c#Winform自定义控件-资源加载窗体

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

  9. c#Winform自定义控件-目录

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

随机推荐

  1. springboot自动装配(2)---实现一个自定义自动装配组件

    对于springboot个人认为它就是整合了各种组件,然后提供对应的自动装配和启动器(starter),基于这个流程去实现一个定义的装配组件 还是这张图 一.创建自己的自动配置工程, spring.f ...

  2. C# 收集几条ToString()格式

    .ToString("C");//¥1,200.00 .ToString("D3");//025 string r3 = 2500.1231.ToString( ...

  3. 关于int和integer

    大家可以看一下下面这个java程序的运行结果 int k = 1; int l = 1; System.out.println(k == l); int a = 128; int b = 128; S ...

  4. 宽度总结-scrollWidth,clientWidth,offectWidth

    平时写js的时候,有时候会遇到这样的情况,需要去计算元素或者屏幕的宽度,再进行不同的处理,但是宽度真的有不少,很容易搞混,特此总结下,也希望大家亲测下,这样比较有体会,记得牢固些. 1.scrollW ...

  5. Spring的注解问题

    Annotation(注解)概述 从JDK5.0开始, Java增加了对元数据(MetaData)的支持,也就是 Annotation(注解). Annotation其实就是代码里的特殊标记,它用于替 ...

  6. SQLyog 破解版

    百度云:链接:http://pan.baidu.com/s/1eSMEzIE    密码:ubi2

  7. C#编程之JSON序列化与反序列化

    1.在C#管理NuGet程序包中添加Json.NET 2.C#将对象序列化成JSON字符串 模型类1 /// <summary> /// JSON字符串模型.是否出错 /// </s ...

  8. python基础知识练习题一

    1.执行Python脚本的两种方式 1.在计算机终端(运行cmd),输入安装的Python路径,然后输入Python脚本的路径,回车. 2.直接运行python 2.简述位.字节的关系. 1字节 = ...

  9. stack函数怎么用嘞?↓↓↓

    c++ stl栈stack的头文件书写格式为: #include 实例化形式如下: stack StackName; 其中成员函数如下: 1.检验堆栈是否为空 empty() 堆栈为空则返回真 形式如 ...

  10. 华三F100 系列防火墙 - 浮动路由联动NQA 实现双线路自动切换

    公司 有两条公网线路,一条移动作为日常主用线路,一条联通作为备用线路. 为了实现主备线路自动切换,配置了浮动路由 但浮动路由只能在 主用接口为down状态时才能浮出接管默认路由.如果故障为非物理链路故 ...