官网

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

准备工作

此控件用到了停靠窗体和日期控件的一个面板,以及基类控件,如果你还对此不了解,请移步

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

(十九)c#Winform自定义控件-停靠窗体

(三十三)c#Winform自定义控件-日期控件

开始

添加一个用户控件,命名UCComboBox,继承自UCControlBase

属性

 Color _ForeColor = Color.FromArgb(, , );
[Description("文字颜色"), Category("自定义")]
public override Color ForeColor
{
get
{
return _ForeColor;
}
set
{
_ForeColor = value;
lblInput.ForeColor = value;
txtInput.ForeColor = value;
}
} public event EventHandler SelectedChangedEvent;
public event EventHandler TextChangedEvent; private ComboBoxStyle _BoxStyle = ComboBoxStyle.DropDown; [Description("控件样式"), Category("自定义")]
public ComboBoxStyle BoxStyle
{
get { return _BoxStyle; }
set
{
_BoxStyle = value;
if (value == ComboBoxStyle.DropDownList)
{
lblInput.Visible = true;
txtInput.Visible = false;
}
else
{
lblInput.Visible = false;
txtInput.Visible = true;
} if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = _BackColor;
base.FillColor = _BackColor;
base.RectColor = _BackColor;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
}
}
} private Font _Font = new Font("微软雅黑", );
[Description("字体"), Category("自定义")]
public new Font Font
{
get { return _Font; }
set
{
_Font = value;
lblInput.Font = value;
txtInput.Font = value;
txtInput.PromptFont = value;
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / );
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / );
}
} [Obsolete("不再可用的属性")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
private new Color FillColor
{
get;
set;
} [Obsolete("不再可用的属性")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
private new Color RectColor
{
get;
set;
} private string _TextValue; public string TextValue
{
get { return _TextValue; }
set
{
_TextValue = value;
if (lblInput.Text != value)
lblInput.Text = value;
if (txtInput.Text != value)
txtInput.Text = value;
}
} private List<KeyValuePair<string, string>> _source = null; public List<KeyValuePair<string, string>> Source
{
get { return _source; }
set
{
_source = value;
_selectedIndex = -;
_selectedValue = "";
_selectedItem = new KeyValuePair<string, string>();
_selectedText = "";
lblInput.Text = "";
txtInput.Text = "";
}
} private KeyValuePair<string, string> _selectedItem = new KeyValuePair<string, string>(); private int _selectedIndex = -; public int SelectedIndex
{
get
{
return _selectedIndex;
}
set
{
if (value < || _source == null || _source.Count <= || value >= _source.Count)
{
_selectedIndex = -;
_selectedValue = "";
_selectedItem = new KeyValuePair<string, string>();
SelectedText = "";
}
else
{
_selectedIndex = value;
_selectedItem = _source[value];
_selectedValue = _source[value].Key;
SelectedText = _source[value].Value;
}
}
} private string _selectedValue = ""; public string SelectedValue
{
get
{
return _selectedValue;
}
set
{
if (_source == null || _source.Count <= )
{
SelectedText = "";
_selectedValue = "";
_selectedIndex = -;
_selectedItem = new KeyValuePair<string, string>();
}
else
{
for (int i = ; i < _source.Count; i++)
{
if (_source[i].Key == value)
{
_selectedValue = value;
_selectedIndex = i;
_selectedItem = _source[i];
SelectedText = _source[i].Value;
return;
}
}
_selectedValue = "";
_selectedIndex = -;
_selectedItem = new KeyValuePair<string, string>();
SelectedText = "";
}
}
} private string _selectedText = ""; public string SelectedText
{
get { return _selectedText; }
private set
{
_selectedText = value;
lblInput.Text = _selectedText;
txtInput.Text = _selectedText;
if (SelectedChangedEvent != null)
{
SelectedChangedEvent(this, null);
}
}
} private int _ItemWidth = ; public int ItemWidth
{
get { return _ItemWidth; }
set { _ItemWidth = value; }
} private int _dropPanelHeight = -; public int DropPanelHeight
{
get { return _dropPanelHeight; }
set { _dropPanelHeight = value; }
}
[Obsolete("不再可用的属性,如需要改变背景色,请使用BackColorExt")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
private new Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = Color.Transparent;
}
} private Color _BackColor = Color.FromArgb(, , ); public Color BackColorExt
{
get
{
return _BackColor;
}
set
{
if (value == Color.Transparent)
return;
_BackColor = value;
lblInput.BackColor = value; if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = value;
base.FillColor = value;
base.RectColor = value;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
}
}
}

构造函数初始化处理

  public UCComboBox()
{
InitializeComponent();
lblInput.BackColor = _BackColor;
if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = _BackColor;
base.FillColor = _BackColor;
base.RectColor = _BackColor;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
}
base.BackColor = Color.Transparent;
}

一些事件处理

 private void UCComboBox_SizeChanged(object sender, EventArgs e)
{
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / );
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / );
} private void txtInput_TextChanged(object sender, EventArgs e)
{
TextValue = txtInput.Text;
if (TextChangedEvent != null)
{
TextChangedEvent(this, null);
}
} private void click_MouseDown(object sender, MouseEventArgs e)
{
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
{ if (this.Source != null && this.Source.Count > )
{
int intRow = ;
int intCom = ;
var p = this.PointToScreen(this.Location);
while (true)
{
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
if ((p.Y + this.Height + this.Source.Count / intCom * < intScreenHeight || p.Y - this.Source.Count / intCom * > )
&& (_dropPanelHeight <= ? true : (this.Source.Count / intCom * <= _dropPanelHeight)))
{
intRow = this.Source.Count / intCom + (this.Source.Count % intCom != ? : );
break;
}
intCom++;
}
UCTimePanel ucTime = new UCTimePanel();
ucTime.IsShowBorder = true;
int intWidth = this.Width / intCom;
if (intWidth < _ItemWidth)
intWidth = _ItemWidth;
Size size = new Size(intCom * intWidth, intRow * );
ucTime.Size = size;
ucTime.FirstEvent = true;
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
ucTime.Row = intRow;
ucTime.Column = intCom;
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
foreach (var item in this.Source)
{
lst.Add(new KeyValuePair<string, string>(item.Key, item.Value));
}
ucTime.Source = lst; ucTime.SetSelect(_selectedValue); _frmAnchor = new Forms.FrmAnchor(this, ucTime);
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; }; _frmAnchor.Show(this.FindForm()); }
}
else
{
_frmAnchor.Close();
}
} Forms.FrmAnchor _frmAnchor;
void ucTime_SelectSourceEvent(object sender, EventArgs e)
{
if (_frmAnchor != null && !_frmAnchor.IsDisposed && _frmAnchor.Visible)
{
SelectedValue = sender.ToString();
_frmAnchor.Close();
}
} private void UCComboBox_Load(object sender, EventArgs e)
{
if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = _BackColor;
base.FillColor = _BackColor;
base.RectColor = _BackColor;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
} //if (this.Parent != null && BackColor == Color.Transparent)
}
}
}

完整代码如下

 // 版权所有  黄正辉  交流群:568015492   QQ:623128629
// 文件名称:UCComboBox.cs
// 创建日期:2019-08-15 15:58:51
// 功能描述:ComboBox
// 项目地址:https://gitee.com/kwwwvagaa/net_winform_custom_control
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
{
[DefaultEvent("SelectedChangedEvent")]
public partial class UCComboBox : UCControlBase
{
Color _ForeColor = Color.FromArgb(, , );
[Description("文字颜色"), Category("自定义")]
public override Color ForeColor
{
get
{
return _ForeColor;
}
set
{
_ForeColor = value;
lblInput.ForeColor = value;
txtInput.ForeColor = value;
}
} public event EventHandler SelectedChangedEvent;
public event EventHandler TextChangedEvent; private ComboBoxStyle _BoxStyle = ComboBoxStyle.DropDown; [Description("控件样式"), Category("自定义")]
public ComboBoxStyle BoxStyle
{
get { return _BoxStyle; }
set
{
_BoxStyle = value;
if (value == ComboBoxStyle.DropDownList)
{
lblInput.Visible = true;
txtInput.Visible = false;
}
else
{
lblInput.Visible = false;
txtInput.Visible = true;
} if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = _BackColor;
base.FillColor = _BackColor;
base.RectColor = _BackColor;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
}
}
} private Font _Font = new Font("微软雅黑", );
[Description("字体"), Category("自定义")]
public new Font Font
{
get { return _Font; }
set
{
_Font = value;
lblInput.Font = value;
txtInput.Font = value;
txtInput.PromptFont = value;
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / );
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / );
}
} [Obsolete("不再可用的属性")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
private new Color FillColor
{
get;
set;
} [Obsolete("不再可用的属性")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
private new Color RectColor
{
get;
set;
} private string _TextValue; public string TextValue
{
get { return _TextValue; }
set
{
_TextValue = value;
if (lblInput.Text != value)
lblInput.Text = value;
if (txtInput.Text != value)
txtInput.Text = value;
}
} private List<KeyValuePair<string, string>> _source = null; public List<KeyValuePair<string, string>> Source
{
get { return _source; }
set
{
_source = value;
_selectedIndex = -;
_selectedValue = "";
_selectedItem = new KeyValuePair<string, string>();
_selectedText = "";
lblInput.Text = "";
txtInput.Text = "";
}
} private KeyValuePair<string, string> _selectedItem = new KeyValuePair<string, string>(); private int _selectedIndex = -; public int SelectedIndex
{
get
{
return _selectedIndex;
}
set
{
if (value < || _source == null || _source.Count <= || value >= _source.Count)
{
_selectedIndex = -;
_selectedValue = "";
_selectedItem = new KeyValuePair<string, string>();
SelectedText = "";
}
else
{
_selectedIndex = value;
_selectedItem = _source[value];
_selectedValue = _source[value].Key;
SelectedText = _source[value].Value;
}
}
} private string _selectedValue = ""; public string SelectedValue
{
get
{
return _selectedValue;
}
set
{
if (_source == null || _source.Count <= )
{
SelectedText = "";
_selectedValue = "";
_selectedIndex = -;
_selectedItem = new KeyValuePair<string, string>();
}
else
{
for (int i = ; i < _source.Count; i++)
{
if (_source[i].Key == value)
{
_selectedValue = value;
_selectedIndex = i;
_selectedItem = _source[i];
SelectedText = _source[i].Value;
return;
}
}
_selectedValue = "";
_selectedIndex = -;
_selectedItem = new KeyValuePair<string, string>();
SelectedText = "";
}
}
} private string _selectedText = ""; public string SelectedText
{
get { return _selectedText; }
private set
{
_selectedText = value;
lblInput.Text = _selectedText;
txtInput.Text = _selectedText;
if (SelectedChangedEvent != null)
{
SelectedChangedEvent(this, null);
}
}
} private int _ItemWidth = ; public int ItemWidth
{
get { return _ItemWidth; }
set { _ItemWidth = value; }
} private int _dropPanelHeight = -; public int DropPanelHeight
{
get { return _dropPanelHeight; }
set { _dropPanelHeight = value; }
}
[Obsolete("不再可用的属性,如需要改变背景色,请使用BackColorExt")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
private new Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = Color.Transparent;
}
} private Color _BackColor = Color.FromArgb(, , ); public Color BackColorExt
{
get
{
return _BackColor;
}
set
{
if (value == Color.Transparent)
return;
_BackColor = value;
lblInput.BackColor = value; if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = value;
base.FillColor = value;
base.RectColor = value;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
}
}
} public UCComboBox()
{
InitializeComponent();
lblInput.BackColor = _BackColor;
if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = _BackColor;
base.FillColor = _BackColor;
base.RectColor = _BackColor;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
}
base.BackColor = Color.Transparent;
} private void UCComboBox_SizeChanged(object sender, EventArgs e)
{
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / );
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / );
} private void txtInput_TextChanged(object sender, EventArgs e)
{
TextValue = txtInput.Text;
if (TextChangedEvent != null)
{
TextChangedEvent(this, null);
}
} private void click_MouseDown(object sender, MouseEventArgs e)
{
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
{ if (this.Source != null && this.Source.Count > )
{
int intRow = ;
int intCom = ;
var p = this.PointToScreen(this.Location);
while (true)
{
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
if ((p.Y + this.Height + this.Source.Count / intCom * < intScreenHeight || p.Y - this.Source.Count / intCom * > )
&& (_dropPanelHeight <= ? true : (this.Source.Count / intCom * <= _dropPanelHeight)))
{
intRow = this.Source.Count / intCom + (this.Source.Count % intCom != ? : );
break;
}
intCom++;
}
UCTimePanel ucTime = new UCTimePanel();
ucTime.IsShowBorder = true;
int intWidth = this.Width / intCom;
if (intWidth < _ItemWidth)
intWidth = _ItemWidth;
Size size = new Size(intCom * intWidth, intRow * );
ucTime.Size = size;
ucTime.FirstEvent = true;
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
ucTime.Row = intRow;
ucTime.Column = intCom;
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
foreach (var item in this.Source)
{
lst.Add(new KeyValuePair<string, string>(item.Key, item.Value));
}
ucTime.Source = lst; ucTime.SetSelect(_selectedValue); _frmAnchor = new Forms.FrmAnchor(this, ucTime);
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; }; _frmAnchor.Show(this.FindForm()); }
}
else
{
_frmAnchor.Close();
}
} Forms.FrmAnchor _frmAnchor;
void ucTime_SelectSourceEvent(object sender, EventArgs e)
{
if (_frmAnchor != null && !_frmAnchor.IsDisposed && _frmAnchor.Visible)
{
SelectedValue = sender.ToString();
_frmAnchor.Close();
}
} private void UCComboBox_Load(object sender, EventArgs e)
{
if (this._BoxStyle == ComboBoxStyle.DropDownList)
{
txtInput.BackColor = _BackColor;
base.FillColor = _BackColor;
base.RectColor = _BackColor;
}
else
{
txtInput.BackColor = Color.White;
base.FillColor = Color.White;
base.RectColor = Color.FromArgb(, , );
}
}
}
}
 namespace HZH_Controls.Controls
{
partial class UCComboBox
{
/// <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.panel1 = new System.Windows.Forms.Panel();
this.txtInput = new HZH_Controls.Controls.TextBoxEx();
this.lblInput = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.ComboBox;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(, );
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(, );
this.panel1.TabIndex = ;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
//
// txtInput
//
this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtInput.BackColor = System.Drawing.Color.White;
this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtInput.DecLength = ;
this.txtInput.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.txtInput.InputType = TextInputType.NotControl;
this.txtInput.Location = new System.Drawing.Point(, );
this.txtInput.Margin = new System.Windows.Forms.Padding(, , , );
this.txtInput.MaxValue = new decimal(new int[] {
,
,
,
});
this.txtInput.MinValue = new decimal(new int[] {
,
,
,
-});
this.txtInput.MyRectangle = new System.Drawing.Rectangle(, , , );
this.txtInput.Name = "txtInput";
this.txtInput.OldText = null;
this.txtInput.PromptColor = System.Drawing.Color.Silver;
this.txtInput.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtInput.PromptText = "";
this.txtInput.RegexPattern = "";
this.txtInput.Size = new System.Drawing.Size(, );
this.txtInput.TabIndex = ;
this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged);
//
// lblInput
//
this.lblInput.AutoSize = true;
this.lblInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.lblInput.Location = new System.Drawing.Point(, );
this.lblInput.Name = "lblInput";
this.lblInput.Size = new System.Drawing.Size(, );
this.lblInput.TabIndex = ;
this.lblInput.Visible = false;
this.lblInput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
//
// UCComboBox
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent;
this.ConerRadius = ;
this.Controls.Add(this.panel1);
this.Controls.Add(this.txtInput);
this.Controls.Add(this.lblInput);
this.FillColor = System.Drawing.Color.Gainsboro;
this.IsShowRect = true;
this.Name = "UCComboBox";
this.Size = new System.Drawing.Size(, );
this.Load += new System.EventHandler(this.UCComboBox_Load);
this.SizeChanged += new System.EventHandler(this.UCComboBox_SizeChanged);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.Panel panel1;
public TextBoxEx txtInput;
private System.Windows.Forms.Label lblInput;
}
}

用处及效果

最后的话

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

最新文章

  1. 记录yii2-imagine几个常用方法
  2. 使用CSS3动画库animate.css
  3. 自定义actionbar标题
  4. PHP系列之一traits的应用
  5. Java中static静态关键字的使用
  6. DataTemplate和ControlTemplate的关系
  7. 为什么针对XML的支持不够好?如何改进?
  8. JS 查找遍历子节点元素
  9. xml解析总结-常用需掌握
  10. Android简易实战教程--第四十四话《ScrollView和HorizontalScrollView简单使用》
  11. 5.0、Android Studio调试你的应用
  12. codeforces-1139 (div2)
  13. (Angular Material)用Autocomplete打造带层级分类的DropDown
  14. 单片机成长之路(51基础篇) - 006 在Linux下搭建51单片机的开发烧写环境
  15. Android中消息系统模型和Handler Looper
  16. POJ1419 Graph Coloring
  17. Token和SessionStorage(会话存储对象)
  18. R入门(一)
  19. 关于UITableView的黑线条
  20. Cocos2d-x学习笔记(十一)动作

热门文章

  1. [leetcode] #239 Sliding Window Maximum (Hard)
  2. C#中线程间操作无效: 从不是创建控件 txtBOX 的线程访问它。
  3. RabbitMQ(三):RabbitMQ与Spring Boot简单整合
  4. Apache Ignite 学习笔记(6): Ignite中Entry Processor使用
  5. Redis 学习笔记(篇七):Redis 持久化
  6. Consul和Kong的实践(一)
  7. ue4使用SceneCapture2D创建小地图示例 蓝图
  8. 释放你的硬盘空间!——Windows 磁盘清理技巧
  9. php 生成随机字符串,数字,大写字母,小写字母,特殊字符可以随意组合
  10. Iphone使用过程中遇到的问题