小细节记录

 错误提醒控件

if(this.textBox1.Text.Length>12||this.textBox1.Text.Length<6)

{

this.errorProvider1.SetError(this.textBox1,"用户名输入错误");

DialogResult ReturnDlg=MessageBox.Show(this,"用户名输入错误,是否从新输入?","信息提示",

MessageBoxButtons.RetryCancel,MessageBoxIcon.Question);

switch(ReturnDlg)

{

case DialogResult.Retry:

this.textBox1.Text="";

break;

case DialogResult.Cancel:

break;

}

使用信息提示控件

this.toolTip1.SetToolTip(this.textBox1,"清输入学生姓名。"); 

 打开文件

this.openFileDialog1.ShowDialog();

string StrFileName=this.openFileDialog1.FileName;

if(StrFileName.Trim()=="")

return;

this.richTextBox1.LoadFile(StrFileName,RichTextBoxStreamType.PlainText);

this.statusBarPanel1.Text="文件名:"+StrFileName; 

 richTextBox1_MouseMove

//检测鼠标的位置

int xPos=Cursor.Position.X;

int yPos=Cursor.Position.Y;

this.statusBarPanel2.Text="鼠标位置:X="+xPos.ToString()+"  Y="+yPos.ToString();  

原文地址:https://www.cnblogs.com/chenqingwei/p/1830432.html