C#编程Tips

1、splitContainer可通过设置Orientation属性变为上下分割:this.splitContainer1.Orientation = Orientation.Vertical 。

2、控件menuStrip1的Dock属性设成 None,就可以随意拖放位置,而不是固定在左上角。

3、去掉TextBox输入回车时的声音。使用KeyPress事件,判断输入的键码KeyChar是否为System.Convert.ToChar(13),最后处理完里面的事件后加上e.Handled = true。

  

  
  
  
  
  1. private void txtInputToDoList_KeyPress(object sender, KeyPressEventArgs  e)  
  2.        {  
  3.            if (e.KeyChar == System.Convert.ToChar(13) && txtInputToDoList.Text.Trim().Length != 0)  
  4.            {  
  5.                addLvToDoListItem();  
  6.                txtInputToDoList.Text = null;  
  7.                e.Handled = true;  
  8.            }              
  9.              
  10.        }  

 

你可能感兴趣的:(职场,C#,tips,休闲)