下載Microsoft Visual Studio 2017 Installer Projects 套件
1.建立打包專案
2018年9月16日 星期日
2018年9月15日 星期六
[C#] 函示庫
1.像是C語言的memcpy
Array.Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length);
2陣列比較
bool result = array1.SequenceEqual(array2);
result = true → Same.
result = false→ Not Same.
[C#] DataGridView
●名詞解釋
●格子座標
dataGridView1[0, 0].Value = "1"; dataGridView1[1, 0].Value = "2"; dataGridView1[0, 1].Value = "3";或
dataGridView1.Rows[0].Cells[0].Value = "1"; dataGridView1.Rows[0].Cells[1].Value = "2"; dataGridView1.Rows[1].Cells[0].Value = "3";
Cell 字型及字體大小
dataGridView1.DefaultCellStyle.Font = New Font("Arial", 9);
[C#] .txt檔存取及讀寫
1.載入.txt檔案
OpenFileDialog openFileDialog1 = new OpenFileDialog(); /*Sets the file dialog box title.*/ openFileDialog1.Title = "Select *.txt"; /*Sets the initial directory displayed by the file dialog box.*/ openFileDialog1.InitialDirectory = "..\\Setting\\"; /*Sets the current file name filter string.*/ openFileDialog1.Filter = "dat files (*.*)|*.txt"; /*Runs a common dialog box with a default owner.*/ if (openFileDialog1.ShowDialog() == DialogResult.OK) { /*Provides a Stream for a file*/ FileStream filestream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read); /*Initializes a new instance of the StreamReader class for the specified stream.*/ StreamReader sr = new StreamReader(filestream); /*選一種方式讀出*/ #if(true) /*一次讀完全部*/ textBox1.Text = sr.ReadToEnd(); #else /*一次讀一行*/ string line; int lineCounter = 0; while((line = sr.ReadLine()) != null) { textBox1.Text += line; /*計算總共有幾行*/ lineCounter++; } #endif }
2018年9月12日 星期三
[C#] 數字(string)和數值(value)之間的轉換
●值(value)轉16進位字串(string)
private void btn1_Click(object sender, EventArgs e) { int value = 10; textBox2.Text = Convert.ToString(value, 16); }
訂閱:
文章 (Atom)