日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

C#-常用

發布時間:2025/6/17 C# 67 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C#-常用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
去空格 str.Trim()最小化窗體 this.WindowState = FormWindowState.Minimized;鼠標拖動窗體 \\********************************************** [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport("user32.dll")] public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); private void frmMain_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, 0x0112, 0xF012, 0); } \\**********************************************獲取自己的名字 Process processes = Process.GetCurrentProcess(); string name =processes.ProcessName; 自己的路徑 string now = Application.StartupPath + @"\" + name + ".exe";獲取桌面路徑 Environment.GetFolderPath(Environment.SpecialFolder.Desktop)System.Diagnostics.Process.Start("cmd.exe");//啟動指定文件 System.Diagnostics.Process.Start("iexplore.exe", "http://www.baidu.com"); System.Diagnostics.Process.Start(@"Notepad.exe");打開記事本 Help.ShowHelp(this, "D:\\虐肆\\工具\\新建文件夾\\Kugou7\\KuGou.exe");打開指定目錄文件 System.Diagnostics.Process.Start("shutdown.exe",@"s,r,a") //帶參數調用進程 System.Diagnostics.Process.Start("shutdown.exe",@"/a");xinxi.Text = xinxi.Text.ToUpper();//字符串轉換成大寫 string Password = User1.Substring(6 ,6) ;截取字符串指定長度 Application.StartupPath; 本地路徑 存字符串 File.WriteAllText(@"C:\Users\asus\Desktop\" + textBox1.Text + ".txt", a);設置拖動改變位置,其實是在空間的點擊和抬起時間里打開和關閉跟隨的timer private void timer2_Tick(object sender, EventArgs e) {int xx = Control.MousePosition.X;//獲得鼠標的xint yy = Control.MousePosition.Y;//獲得鼠標的ythis.Location = new Point(xx - 500, yy - 160); }獲取當前時間 時間.Text = DateTime.Now.ToString(); n = DateTime.Now.Year; y = DateTime.Now.Month; r = DateTime.Now.Day; s = DateTime.Now.Hour; f = DateTime.Now.Minute; m = DateTime.Now.Second; time = DateTime.Now.DayOfWeek.ToString();//星期 if (time == "Monday") time = "星期一"; if (time == "Tuesday") time = "星期二"; if (time == "Wednesday") time = "星期三"; if (time == "Thursday") time = "星期四"; if (time == "Friday") time = "星期五"; if (time == "Saturday") time = "星期六"; if (time == "Sunday") time = "星期日";System.Diagnostics.Process.Start("shutdown.exe", @"/p");強制直接關機 System.Diagnostics.Process.Start("shutdown.exe", @"/r");重啟 System.Diagnostics.Process.Start("shutdown.exe", @"/l"); 注銷字符串和byte之間的轉換 string tmp = Encoding.UTF8.GetString(result, 0, len); Encoding.UTF8.GetBytes("aaaaa")this.TopMost = true;最前面 textbox1.Focus(); 獲取交點if (File.Exists(@"C:\Users\Administrator\Desktop\批處理\常用總結\if.txt")) MessageBox.Show("ok");判斷該文件是否存在string strHostName = Dns.GetHostName(); //得到本機的主機名 IPHostEntry ipEntry = Dns.GetHostByName(strHostName); //取得本機IP string strAddr = ipEntry.AddressList[0].ToString(); //假設本地主機為單網卡指定路徑的文件變成byte byte[] img = System.IO.File.ReadAllBytes(Application .StartupPath +"\\Picture\\"+id +".jpg");獲取本地IPprivate void GetLocalIpAddress(){try{string strHostName = Dns.GetHostName();IPHostEntry ipEntry = Dns.GetHostByName(strHostName);string strAddr = ipEntry.AddressList[0].ToString();rtIpaddress.Text = strAddr;rtIpaddress.Items.Clear();rtIpaddress.Items.Add("127.0.0.1");for (int i = 0; i < 10; i++){strAddr = ipEntry.AddressList[i].ToString();rtIpaddress.Items.Add(strAddr);}}catch { }}

總結

以上是生活随笔為你收集整理的C#-常用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。