(十一)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
准备工作
列表控件将被拆分为2部分,一个元素,一个列表,列表需要支持主副标题,图标等
开始
首先定义一个数据源类(其实更好的是应该接受object,然后通过绑定字段反射绑定数据,这样就不需要这个数据源类了,这里偷懒了)
/// <summary>
/// 列表实体
/// </summary>
[Serializable]
public class ListEntity
{
/// <summary>
/// 编码,唯一值
/// </summary>
public string ID { get; set; }
/// <summary>
/// 大标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 右侧更多按钮
/// </summary>
public bool ShowMoreBtn { get; set; }
/// <summary>
/// 右侧副标题
/// </summary>
public string Title2 { get; set; }
/// <summary>
/// 关联的数据源
/// </summary>
public object Source { get; set; }
}
我们创建元素控件,添加一个用户控件,命名UCListItemExt
需要提供一下属性
[Description("标题"), Category("自定义")]
public string Title
{
get { return label1.Text; }
set { label1.Text = value; }
}
[Description("副标题"), Category("自定义")]
public string Title2
{
get { return label3.Text; }
set
{
label3.Text = value;
label3.Visible = !string.IsNullOrEmpty(value);
}
} [Description("标题字体"), Category("自定义")]
public Font TitleFont
{
get { return label1.Font; }
set
{
label1.Font = value;
}
} [Description("副标题字体"), Category("自定义")]
public Font Title2Font
{
get { return label3.Font; }
set
{
label3.Font = value;
}
} [Description("背景色"), Category("自定义")]
public Color ItemBackColor
{
get { return this.BackColor; }
set
{
this.BackColor = value;
}
} [Description("标题文本色"), Category("自定义")]
public Color ItemForeColor
{
get { return label1.ForeColor; }
set { label1.ForeColor = value; }
} [Description("副标题文本色"), Category("自定义")]
public Color ItemForeColor2
{
get { return label3.ForeColor; }
set { label3.ForeColor = value; }
} [Description("是否显示右侧更多箭头"), Category("自定义")]
public bool ShowMoreBtn
{
get { return label2.Visible; }
set { label2.Visible = value; ; }
} [Description("项选中事件"), Category("自定义")]
public event EventHandler ItemClick; /// <summary>
/// 数据源
/// </summary>
public ListEntity DataSource { get; private set; }
开放一个对外的设置数据源入口
#region 设置数据
/// <summary>
/// 功能描述:设置数据
/// 作 者:HZH
/// 创建日期:2019-02-27 11:52:52
/// 任务编号:POS
/// </summary>
/// <param name="data">data</param>
public void SetData(ListEntity data)
{
this.Title = data.Title;
this.Title2 = data.Title2;
this.ShowMoreBtn = data.ShowMoreBtn;
DataSource = data;
}
#endregion
再处理一下点击事件
private void item_MouseDown(object sender, MouseEventArgs e)
{
if (ItemClick != null)
{
ItemClick(this, e);
}
}
至此功能完成,看下完整代码
// 版权所有 黄正辉 交流群:568015492 QQ:623128629
// 文件名称:UCListItemExt.cs
// 创建日期:2019-08-15 16:01:34
// 功能描述:List
// 项目地址: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
{
[ToolboxItem(false)]
public partial class UCListItemExt : UserControl
{
[Description("标题"), Category("自定义")]
public string Title
{
get { return label1.Text; }
set { label1.Text = value; }
}
[Description("副标题"), Category("自定义")]
public string Title2
{
get { return label3.Text; }
set
{
label3.Text = value;
label3.Visible = !string.IsNullOrEmpty(value);
}
} [Description("标题字体"), Category("自定义")]
public Font TitleFont
{
get { return label1.Font; }
set
{
label1.Font = value;
}
} [Description("副标题字体"), Category("自定义")]
public Font Title2Font
{
get { return label3.Font; }
set
{
label3.Font = value;
}
} [Description("背景色"), Category("自定义")]
public Color ItemBackColor
{
get { return this.BackColor; }
set
{
this.BackColor = value;
}
} [Description("标题文本色"), Category("自定义")]
public Color ItemForeColor
{
get { return label1.ForeColor; }
set { label1.ForeColor = value; }
} [Description("副标题文本色"), Category("自定义")]
public Color ItemForeColor2
{
get { return label3.ForeColor; }
set { label3.ForeColor = value; }
} [Description("是否显示右侧更多箭头"), Category("自定义")]
public bool ShowMoreBtn
{
get { return label2.Visible; }
set { label2.Visible = value; ; }
} [Description("项选中事件"), Category("自定义")]
public event EventHandler ItemClick; /// <summary>
/// 数据源
/// </summary>
public ListEntity DataSource { get; private set; } public UCListItemExt()
{
InitializeComponent();
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
this.UpdateStyles();
} private void item_MouseDown(object sender, MouseEventArgs e)
{
if (ItemClick != null)
{
ItemClick(this, e);
}
} #region 设置数据
/// <summary>
/// 功能描述:设置数据
/// 作 者:HZH
/// 创建日期:2019-02-27 11:52:52
/// 任务编号:POS
/// </summary>
/// <param name="data">data</param>
public void SetData(ListEntity data)
{
this.Title = data.Title;
this.Title2 = data.Title2;
this.ShowMoreBtn = data.ShowMoreBtn;
DataSource = data;
}
#endregion
}
}
namespace HZH_Controls.Controls
{
partial class UCListItemExt
{
/// <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.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCListItemExt));
this.label1 = new System.Windows.Forms.Label();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.label3 = new System.Windows.Forms.Label();
this.splitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(, , , );
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = ;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.item_MouseDown);
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(, "setting_arrow.png");
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Right;
this.label3.Font = new System.Drawing.Font("微软雅黑", 14F);
this.label3.ForeColor = System.Drawing.Color.FromArgb(, , );
this.label3.Location = new System.Drawing.Point(, );
this.label3.Name = "label3";
this.label3.Padding = new System.Windows.Forms.Padding(, , , );
this.label3.Size = new System.Drawing.Size(, );
this.label3.TabIndex = ;
this.label3.Text = "label3";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.item_MouseDown);
//
// splitLine_H1
//
this.splitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.splitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitLine_H1.Location = new System.Drawing.Point(, );
this.splitLine_H1.MaximumSize = new System.Drawing.Size(, );
this.splitLine_H1.Name = "splitLine_H1";
this.splitLine_H1.Size = new System.Drawing.Size(, );
this.splitLine_H1.TabIndex = ;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Right;
this.label2.ImageIndex = ;
this.label2.ImageList = this.imageList1;
this.label2.Location = new System.Drawing.Point(, );
this.label2.Name = "label2";
this.label2.Padding = new System.Windows.Forms.Padding(, , , );
this.label2.Size = new System.Drawing.Size(, );
this.label2.TabIndex = ;
this.label2.Visible = false;
this.label2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.item_MouseDown);
//
// UCListItemExt
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.label1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.splitLine_H1);
this.Name = "UCListItemExt";
this.Size = new System.Drawing.Size(, );
this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.Label label3;
private UCSplitLine_H splitLine_H1;
}
}
设计样式如下
接着我们需要创建列表控件,添加用户控件,命名UCListExt
看下需要哪些属性
private Font _titleFont = new Font("微软雅黑", 15F);
[Description("标题字体"), Category("自定义")]
public Font TitleFont
{
get { return _titleFont; }
set { _titleFont = value; }
}
private Font _title2Font = new Font("微软雅黑", 14F);
[Description("副标题字体"), Category("自定义")]
public Font Title2Font
{
get { return _title2Font; }
set { _title2Font = value; }
} private Color _itemBackColor = Color.White;
[Description("标题背景色"), Category("自定义")]
public Color ItemBackColor
{
get { return _itemBackColor; }
set { _itemBackColor = value; }
} private Color _itemSelectedBackColor = Color.FromArgb(, , ); [Description("标题选中背景色"), Category("自定义")]
public Color ItemSelectedBackColor
{
get { return _itemSelectedBackColor; }
set { _itemSelectedBackColor = value; }
} private Color _itemForeColor = Color.Black; [Description("标题文本色"), Category("自定义")]
public Color ItemForeColor
{
get { return _itemForeColor; }
set { _itemForeColor = value; }
}
private Color _itemSelectedForeColor = Color.White; [Description("标题选中文本色"), Category("自定义")]
public Color ItemSelectedForeColor
{
get { return _itemSelectedForeColor; }
set { _itemSelectedForeColor = value; }
}
private Color _itemForeColor2 = Color.FromArgb(, , ); [Description("副标题文本色"), Category("自定义")]
public Color ItemForeColor2
{
get { return _itemForeColor2; }
set { _itemForeColor2 = value; }
}
private Color _itemSelectedForeColor2 = Color.White; [Description("副标题选中文本色"), Category("自定义")]
public Color ItemSelectedForeColor2
{
get { return _itemSelectedForeColor2; }
set { _itemSelectedForeColor2 = value; }
} private int _itemHeight = ; [Description("项高度"), Category("自定义")]
public int ItemHeight
{
get { return _itemHeight; }
set { _itemHeight = value; }
} private bool _autoSelectFirst = true;
[Description("自动选中第一项"), Category("自定义")]
public bool AutoSelectFirst
{
get { return _autoSelectFirst; }
set { _autoSelectFirst = value; }
}
public delegate void ItemClickEvent(UCListItemExt item);
[Description("选中项事件"), Category("自定义")]
public event ItemClickEvent ItemClick; private bool _selectedCanClick = false;
[Description("选中后是否可以再次触发点击事件"), Category("自定义")]
public bool SelectedCanClick
{
get { return _selectedCanClick; }
set { _selectedCanClick = value; }
} /// <summary>
/// 选中的节点
/// </summary>
public UCListItemExt SelectItem
{
get { return _current; }
}
向外暴露一个设置数据源的函数
public void SetList(List<ListEntity> lst)
{
try
{
ControlHelper.FreezeControl(this, true);
this.Controls.Clear();
this.SuspendLayout();
UCListItemExt _first = null;
for (int i = lst.Count - ; i >= ; i--)
{
var item = lst[i];
UCListItemExt li = new UCListItemExt();
li.Height = _itemHeight;
li.TitleFont = _titleFont;
li.Title2Font = _title2Font;
li.ItemBackColor = _itemBackColor;
li.ItemForeColor = _itemForeColor;
li.ItemForeColor2 = _itemForeColor2;
li.Dock = DockStyle.Top;
li.SetData(item);
li.ItemClick += (s, e) => { SelectLabel((UCListItemExt)s); };
this.Controls.Add(li);
_first = li;
}
if (_autoSelectFirst)
SelectLabel(_first);
this.ResumeLayout(false); Timer timer = new Timer();
timer.Interval = ;
timer.Tick += (a, b) =>
{
timer.Enabled = false;
this.VerticalScroll.Value = ;
this.VerticalScroll.Value = ;
this.Refresh();
};
timer.Enabled = true;
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
选中项的处理
private void SelectLabel(UCListItemExt li)
{
try
{
HZH_Controls.ControlHelper.FreezeControl(this, true);
this.FindForm().ActiveControl = this;
if (_current != null)
{
if (_current == li && !_selectedCanClick)
return;
_current.ItemBackColor = _itemBackColor;
_current.ItemForeColor = _itemForeColor;
_current.ItemForeColor2 = _itemForeColor2;
}
li.ItemBackColor = _itemSelectedBackColor;
li.ItemForeColor = _itemSelectedForeColor;
li.ItemForeColor2 = _itemSelectedForeColor2; _current = li;
if (ItemClick != null)
{
ItemClick(li);
}
}
finally
{
HZH_Controls.ControlHelper.FreezeControl(this, false);
}
}
完成,看下完整代码
// 版权所有 黄正辉 交流群:568015492 QQ:623128629
// 文件名称:UCListExt.cs
// 创建日期:2019-08-15 16:01:22
// 功能描述:List
// 项目地址: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("ItemClick")]
public partial class UCListExt : UserControl
{
private Font _titleFont = new Font("微软雅黑", 15F);
[Description("标题字体"), Category("自定义")]
public Font TitleFont
{
get { return _titleFont; }
set { _titleFont = value; }
}
private Font _title2Font = new Font("微软雅黑", 14F);
[Description("副标题字体"), Category("自定义")]
public Font Title2Font
{
get { return _title2Font; }
set { _title2Font = value; }
} private Color _itemBackColor = Color.White;
[Description("标题背景色"), Category("自定义")]
public Color ItemBackColor
{
get { return _itemBackColor; }
set { _itemBackColor = value; }
} private Color _itemSelectedBackColor = Color.FromArgb(, , ); [Description("标题选中背景色"), Category("自定义")]
public Color ItemSelectedBackColor
{
get { return _itemSelectedBackColor; }
set { _itemSelectedBackColor = value; }
} private Color _itemForeColor = Color.Black; [Description("标题文本色"), Category("自定义")]
public Color ItemForeColor
{
get { return _itemForeColor; }
set { _itemForeColor = value; }
}
private Color _itemSelectedForeColor = Color.White; [Description("标题选中文本色"), Category("自定义")]
public Color ItemSelectedForeColor
{
get { return _itemSelectedForeColor; }
set { _itemSelectedForeColor = value; }
}
private Color _itemForeColor2 = Color.FromArgb(, , ); [Description("副标题文本色"), Category("自定义")]
public Color ItemForeColor2
{
get { return _itemForeColor2; }
set { _itemForeColor2 = value; }
}
private Color _itemSelectedForeColor2 = Color.White; [Description("副标题选中文本色"), Category("自定义")]
public Color ItemSelectedForeColor2
{
get { return _itemSelectedForeColor2; }
set { _itemSelectedForeColor2 = value; }
} private int _itemHeight = ; [Description("项高度"), Category("自定义")]
public int ItemHeight
{
get { return _itemHeight; }
set { _itemHeight = value; }
} private bool _autoSelectFirst = true;
[Description("自动选中第一项"), Category("自定义")]
public bool AutoSelectFirst
{
get { return _autoSelectFirst; }
set { _autoSelectFirst = value; }
}
public delegate void ItemClickEvent(UCListItemExt item);
[Description("选中项事件"), Category("自定义")]
public event ItemClickEvent ItemClick; private bool _selectedCanClick = false;
[Description("选中后是否可以再次触发点击事件"), Category("自定义")]
public bool SelectedCanClick
{
get { return _selectedCanClick; }
set { _selectedCanClick = value; }
} /// <summary>
/// 选中的节点
/// </summary>
public UCListItemExt SelectItem
{
get { return _current; }
}
UCListItemExt _current = null;
public UCListExt()
{
InitializeComponent();
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
this.UpdateStyles();
} public void SetList(List<ListEntity> lst)
{
try
{
ControlHelper.FreezeControl(this, true);
this.Controls.Clear();
this.SuspendLayout();
UCListItemExt _first = null;
for (int i = lst.Count - ; i >= ; i--)
{
var item = lst[i];
UCListItemExt li = new UCListItemExt();
li.Height = _itemHeight;
li.TitleFont = _titleFont;
li.Title2Font = _title2Font;
li.ItemBackColor = _itemBackColor;
li.ItemForeColor = _itemForeColor;
li.ItemForeColor2 = _itemForeColor2;
li.Dock = DockStyle.Top;
li.SetData(item);
li.ItemClick += (s, e) => { SelectLabel((UCListItemExt)s); };
this.Controls.Add(li);
_first = li;
}
if (_autoSelectFirst)
SelectLabel(_first);
this.ResumeLayout(false); Timer timer = new Timer();
timer.Interval = ;
timer.Tick += (a, b) =>
{
timer.Enabled = false;
this.VerticalScroll.Value = ;
this.VerticalScroll.Value = ;
this.Refresh();
};
timer.Enabled = true;
}
finally
{
ControlHelper.FreezeControl(this, false);
}
} private void SelectLabel(UCListItemExt li)
{
try
{
HZH_Controls.ControlHelper.FreezeControl(this, true);
this.FindForm().ActiveControl = this;
if (_current != null)
{
if (_current == li && !_selectedCanClick)
return;
_current.ItemBackColor = _itemBackColor;
_current.ItemForeColor = _itemForeColor;
_current.ItemForeColor2 = _itemForeColor2;
}
li.ItemBackColor = _itemSelectedBackColor;
li.ItemForeColor = _itemSelectedForeColor;
li.ItemForeColor2 = _itemSelectedForeColor2; _current = li;
if (ItemClick != null)
{
ItemClick(li);
}
}
finally
{
HZH_Controls.ControlHelper.FreezeControl(this, false);
}
} } }
namespace HZH_Controls.Controls
{
partial class UCListExt
{
/// <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();
//
// ListExt
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScroll = true;
this.Name = "ListExt";
this.Size = new System.Drawing.Size(, );
this.ResumeLayout(false); } #endregion
}
}
用处及效果
调用示例
List<ListEntity> lst = new List<ListEntity>();
for (int i = ; i < ; i++)
{
lst.Add(new ListEntity()
{
ID = i.ToString(),
Title = "选项" + i,
ShowMoreBtn = true,
Source = i
});
}
this.ucListExt1.SetList(lst);
最后的话
如果你喜欢的话,请到 https://gitee.com/kwwwvagaa/net_winform_custom_control 点个星 星吧
(十一)c#Winform自定义控件-列表的更多相关文章
- c#Winform自定义控件-目录
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- winform 自定义控件(高手)
高手推荐:https://www.cnblogs.com/bfyx/p/11364884.html c#Winform自定义控件-目录 前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件 ...
- (三十一)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 ...
- (三十二)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年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...
- (四十七)c#Winform自定义控件-树表格(treeGrid)
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...
随机推荐
- Bzoj 1997 [Hnoi2010]Planar题解
1997: [Hnoi2010]Planar Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 2224 Solved: 824[Submit][Stat ...
- 个人永久性免费-Excel催化剂功能第69波-专业图表库新增图表-刘万祥老师中国地图
Excel催化剂的[专业图表库],仅提供一个工具的输出,让用户可以在制作专业图表过程中更低的门槛,更快速的完成所想要实现的图表.具体参考:第69波-打造最专业易用的商务图表库https://www.j ...
- 洛谷 P1101-题解
这道题可以用深搜(回溯)来写,相信大部分人都是这么想的,但是有些人可能在一些地方饶了半天,所以这里就贴一下我的思路,个人觉得自己的很好懂,除了tx和ty那里,但是tx和ty的那种用法对于输出路径的题目 ...
- Hadoop值Partition分区
分区操作 为什么要分区? 要求将统计结果按照条件输出到不同文件中(分区).比如:将统计结果按 照手机归属地不同省份输出到不同文件中(分区) 默认 partition 分区 /** 源码中:numRed ...
- [leetcode] 110. Balanced Binary Tree (easy)
原题链接 水题 深度搜索每一节点的左右深度,左右深度差大于1就返回false. class Solution { public: bool isBalanced(TreeNode *root) { b ...
- Java中的I/O输入输出流概述
流是一组有序的数据序列,根据操作类型,可以分为输入流和输出流两种,Java语言中定义的负责各种输入输出的类都被放在java.io包中.其中所有的输入流类都是抽象类InputStream(字节输入流)或 ...
- Java网络和代理
Java网络和代理 1)简介 在当今的网络环境中,特别是企业网络环境中,应用程序开发人员必须像系统管理员一样频繁地处理代理.在某些情况下,应用程序应该使用系统默认设置,在其他情况下,我们希望能够非常严 ...
- 头部姿态估计 - OpenCV/Dlib/Ceres
基本思想 通过Dlib获得当前人脸的特征点,然后通过旋转平移标准模型的特征点进行拟合,计算标准模型求得的特征点与Dlib获得的特征点之间的差,使用Ceres不断迭代优化,最终得到最佳的旋转和平移参数. ...
- django第四次(转自刘江)
我们都知道对于ManyToMany字段,Django采用的是第三张中间表的方式.通过这第三张表,来关联ManyToMany的双方.下面我们根据一个具体的例子,详细解说中间表的使用. 一.默认中间表 首 ...
- Prometheus 整合 AlertManager
简介 Alertmanager 主要用于接收 Prometheus 发送的告警信息,它很容易做到告警信息的去重,降噪,分组,策略路由,是一款前卫的告警通知系统.它支持丰富的告警通知渠道,可以将告警信息 ...