Time of Update: 2018-12-04
using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Runtime.InteropServices;namespace ConsoleApplication22{ class Program { [DllImport("Ws2_32.dll")] public static extern uint
Time of Update: 2018-12-04
using System;using System.IO;using System.Text;using System.Runtime.InteropServices;class IniFileHandler{ [DllImport("KERNEL32.DLL")] public static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string
Time of Update: 2018-12-04
C# 集合類 http://www.cnblogs.com/czyhsl/archive/2010/09/19/1831022.html C#操作XML小結http://www.cnblogs.com/zyf19860907/archive/2010/09/28/1837318.html C#實現控制項隨表單拖動而自動縮放其大小http://www.cnblogs.com/yuxuan/archive/2010/09/25/1834448.htmlC#實現表單和任意控制項的拖動http://
Time of Update: 2018-12-04
版本號碼: 0.0001.0002.00003 1、正常要求:得到的版本號碼:0.1.2.3Assembly.GetExecutingAssembly().GetName().Version.ToString();====================================================2、非正常要求:得到版本號碼: 0.0001.0002.00003Application.ProductVersion.ToString(); -----------------
Time of Update: 2018-12-04
string s = "測試文字,隨便寫一些文字"; foreach (char c in s) { textBox1.AppendText(c.ToString()); int tick = Environment.TickCount; //間隔時間,按你自己喜好,我這裡寫100毫秒 while
Time of Update: 2018-12-04
用C#實現實現簡單的 Ping 的功能,用於測試網路是否已經聯通1. 根據IP地址獲得主機名稱 /// <summary> /// 根據IP地址獲得主機名稱 /// </summary> /// <param name="ip">主機的IP地址</param> /// <returns>主機名稱</returns> public
Time of Update: 2018-12-04
using System.IO; private void button1_Click(object sender, EventArgs e) { String strXmlFilePath = "D://job//test//code//Convertor"; DirectoryInfo di = new DirectoryInfo(strXmlFilePath); FileInfo[] f =
Time of Update: 2018-12-04
private void button1_Click(object sender, EventArgs e) { RunWhenStart(false, "mystarton", @"C:/Program Files/UltraEdit/Uedit32.exe"); } /// <summary> /// 開機啟動項 /// </summary> ///
Time of Update: 2018-12-04
1、一個類,利用方法向線程傳資料。 //要傳的資料結構 public struct data { public string message; } //具體功能的方法,注意是object類型 static void ThreadMainWithPra(object o) { data d = (data)o;
Time of Update: 2018-12-04
//在Form的屬性中要設定 AlowDrop為true private void Form1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetData(DataFormats.FileDrop) != null) { e.Effect = DragDropEffects.Copy; }
Time of Update: 2018-12-04
1.簡單的根據Key的值來擷取xml的value <?xml version="1.0" standalone="no"?><!--This is a comment--><configSections> <appSettings> <add key="MySqlCon" value="Database=test;Data Source=127.0.0.1;User
Time of Update: 2018-12-04
自訂控制項CalenderAD,其中包含三個TextBox txtYear,txtMonth,txtYear;1.首先在自訂控制項中定義兩個string型的變數ErrMessage,OprMessage,用來儲存資訊;在CalenderAD中的TextBox 做KeyPress時ErrMessage,OprMessage擷取相關資訊;2.在主表單中InitializeComponent()中添加事件: this.calenderAD.txtYear.Enter +=
Time of Update: 2018-12-04
/// <summary> /// 重載ProcessCmdKey事件 /// </summary> /// <param name="msg"></param> /// <param name="keyData"></param> /// <returns></returns> protected
Time of Update: 2018-12-04
正常來說,那麼winform是擷取不到EXE的傳回值,這時我所用的方法是把EXE中的值寫到csv檔案中,然後winform去讀取csv private void btnGoodsSelect_Click(object sender, EventArgs e) { ParameterizedThreadStart pts = new ParameterizedThreadStart(RunCommand); Thread
Time of Update: 2018-12-04
[System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int wndproc); [System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int GetWindow
Time of Update: 2018-12-04
堆排序的主要原理就是利用堆的特點,首先產生最大堆,然後每次取堆的root和最後一個葉子交換,剔除最後葉子。然後再次產生最大堆,迴圈。 /// <summary> /// 堆排序 /// </summary> /// <param name="Myarray"></param> /// <returns></returns> private int[]
Time of Update: 2018-12-04
/// <summary> /// 歸併排序 /// </summary> /// <param name="Myarray"></param> /// <returns></returns> private int[] MergerSotr(int[] Myarray) { int len=1;
Time of Update: 2018-12-04
private void button1_Click(object sender, EventArgs e) { /** * 表單上需要有: * 按鈕:點擊用的 * 一個文字框控制項:裝載常值內容 * 一個PIC box檔案:裝複製後的圖片內容 **/ IDataObject iData =
Time of Update: 2018-12-04
在頁面page_load中: int num = 0; for (int i = 0; i < dt_data.Rows.Count; i++) { dgv.Rows.Add(); int n = dgv.Rows.Count - 1; for (int j = 2; j
Time of Update: 2018-12-04
快速排序主要是利用一個臨時儲存空間儲存一個支點,以支點作為比較標準,大小兩個序列分在支點的兩邊。然後遞迴兩個序列。 /// <summary> /// 快速排序 /// </summary> /// <param name="Myarray">數組</param> /// <param name="low">低位</param> ///