随笔分类 -  C#

摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System. 阅读全文
posted @ 2020-11-01 21:52 WP-WangPin 阅读(152) 评论(0) 推荐(0)
摘要://获取日期+时间 DateTime.Now.ToString(); // 2008-9-4 20:02:10 DateTime.Now.ToLocalTime().ToString(); // 2008-9-4 20:12:12 //获取日期 DateTime.Now.ToLongDateStri 阅读全文
posted @ 2020-11-01 18:17 WP-WangPin 阅读(2874) 评论(0) 推荐(0)
摘要:public Form1() { InitializeComponent(); System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;//设置该属性 为false } 阅读全文
posted @ 2020-11-01 18:04 WP-WangPin 阅读(125) 评论(0) 推荐(0)
摘要:if (clientSocket.Connected) { } 阅读全文
posted @ 2020-10-31 03:25 WP-WangPin 阅读(257) 评论(0) 推荐(0)
摘要:private void richTextBox2_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { // button2.Focus(); button1_Click(sender, e); } if ( 阅读全文
posted @ 2020-10-31 03:18 WP-WangPin 阅读(2034) 评论(0) 推荐(1)
摘要:阻塞模式 Windows套接字在阻塞和非阻塞两种模式下执行I/O操作。在阻塞模式下,在I/O操作完成前,执行的操作函数一直等候而不会立即返回,该函数所在的线程会阻塞在这里。相反,在非阻塞模式下,套接字函数会立即返回,而不管I/O是否完成,该函数所在的线程会继续运行。 在阻塞模式的套接字上,调用任何一 阅读全文
posted @ 2020-10-31 02:53 WP-WangPin 阅读(2285) 评论(0) 推荐(0)
摘要:在keypress事件中 private void richTextBox2_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { textbox.Focus(); } if (e.KeyChar == Sys 阅读全文
posted @ 2020-10-31 02:33 WP-WangPin 阅读(127) 评论(0) 推荐(0)
摘要:Environment.Exit(0)//可以退出单独开启的线程 阅读全文
posted @ 2020-10-30 21:50 WP-WangPin 阅读(128) 评论(0) 推荐(0)
摘要:Application.ExitThread();//释放所有线程 阅读全文
posted @ 2020-10-30 21:01 WP-WangPin 阅读(886) 评论(0) 推荐(0)
摘要:listenerThread.Abort(); 阅读全文
posted @ 2020-10-30 20:55 WP-WangPin 阅读(203) 评论(0) 推荐(0)
摘要:DialogResult result = MessageBox.Show("你将删除账号中所有的课程信息,删除后将不可恢复,是否继续删除?", "确认删除", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == D 阅读全文
posted @ 2020-10-30 18:04 WP-WangPin 阅读(90) 评论(0) 推荐(0)
摘要:返回用来收发数据的套接字 private Socket getSocket(string ip, int p) { Socket socketclient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType 阅读全文
posted @ 2020-10-30 17:59 WP-WangPin 阅读(772) 评论(0) 推荐(0)
摘要:public string GetLocalIp() { ///获取本地的IP地址 string AddressIP = string.Empty; foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).Addres 阅读全文
posted @ 2020-10-30 17:51 WP-WangPin 阅读(134) 评论(0) 推荐(0)
摘要:Convert.ToInt32("123"); 阅读全文
posted @ 2020-10-30 17:49 WP-WangPin 阅读(1356) 评论(0) 推荐(0)