WinForm框架备忘
1.添加自定义格式化xtragrid的显示样式,例如dev的例子
需要保存格式化条件 参考http://www.cnblogs.com/haifengtech/archive/2011/07/14/2106482.html;
2. 封装exception
if (!this.DesignMode)
{
// 设置鼠标繁忙状态
this.Cursor = Cursors.WaitCursor;
try
{
this.FormOnLoad();
}
catch (Exception ex)
{
this.ProcessException(ex);
}
finally
{
// 设置鼠标默认状态
this.Cursor = Cursors.Default;
}
}
3.层次之间的耦合关系及数据组织方面,可以在适当的时候用IOC的思想;
用AOP把一些系统必要功能但不是业务功能的function以AOP的方式独立出来,让他们以attribute的方式出现在系统中,以后维护和重构简直是如鱼得水
4. 封装clearform
///<summary>
/// 清除容器里面某些控件的值
///</summary>
///<param name="parContainer">容器类控件</param>
public void ClearCntrValue(Control parContainer)
{
for (int index = 0; index < parContainer.Controls.Count; index++)
{
// 如果是容器类控件,递归调用自己
if (parContainer.Controls[index].HasChildren)
{
ClearCntrValue(parContainer.Controls[index]);
}
else
{
switch(parContainer.Controls[index].GetType().Name)
{
case "TextBox":
parContainer.Controls[index].Text = "";
break;
case "RadioButton":
((RadioButton)(parContainer.Controls[index])).Checked = false;
break;
case "CheckBox":
((CheckBox)(parContainer.Controls[index])).Checked = false;
break;
case "ComboBox":
((ComboBox)(parContainer.Controls[index])).Text = "";
break;
}
}
}
}
5. 新增多行
6.xtragrid拖放效果
7.layoutcontrol
8.多级navbar
9.xtragrid的checkbox
10.save layout setting
11.export to excel doc
12.工具栏浮动到其他地方
13.设置查询条件helper类
SearchCondition condition = new SearchCondition();
condition.AddCondition("ProductName", this.txtName.Text, SqlOperator.Like)
.AddCondition("ProductType", this.cmbProductType.Text, SqlOperator.Like)
.AddCondition("Specification", this.cmbSpecNumber.Text, SqlOperator.Like)
.AddCondition("Note", this.txtNote.Text, SqlOperator.Like)
.AddCondition("Manufacture", this.cmbManufacture.Text, SqlOperator.Like);
string where = condition.BuildConditionSql().Replace("Where", "");
14.加载泛型窗体
public F Launch<F>() where F : Form, new() { F dlg = new F(); dlg.MdiParent = this; dlg.Show(); return dlg; };
15.泛型窗体继承问题?????;
16.delegate event;
17.bindingsource;
18.findcontrol<T>();