Convert.ToString(數值, 基底)example 1.Convert.ToString(5, 2) 結果: 101example 2. 補齊4位數Convert.ToString(5, 2).PadLeft(4,'0') 結果: 0101
1: int action = 1; // 0:display, 1:write, 2:erase
2: int block = 1; // 0~15, block number
3: string para = Convert.ToString(action, 2).PadLeft(4, '0') + Convert.ToString(block, 2).PadLeft(4, '0');
4: int data = Convert.ToInt32(para, 2);
5: byte b = byte.Parse(data.ToString());
me1237guy 發表在 痞客邦 留言(0) 人氣(1,106)

加入小圖案目錄夾至專案命名資料夾bmp加入->現有項目複選a~d四張bmp照片宣告全域變數private ImageList G_ImageList;滑鼠double click專案中Properties資料夾, 選擇<資源>, <加入資源>下拉點選<加入資源>下拉點選<加入現有檔案>加入後如下:========================================================================
me1237guy 發表在 痞客邦 留言(0) 人氣(174)

變更Form1的FormBoarderStyle 屬性從“Sizable” 改成 “None” 打開Form1_Designer.cs加入下列this.TransparencyKey = System.Drawing.SystemColors.Control;
1: protected override void OnPaint(PaintEventArgs e)
2: { 3: e.Graphics.DrawImage((Image)bmp, new Point(0, 0));
4: }
5: private void Form1_Load(object sender, EventArgs e)
6: { 7: string sDir = System.IO.Directory.GetCurrentDirectory();
8: bmp = new Bitmap(sDir + "\\images.png");
9: bmp.MakeTransparent(Color.Blue);
10: }
me1237guy 發表在 痞客邦 留言(0) 人氣(49)

會進入一個頁面提示下載InstallShield網址=====================================================================Visual Studio 2010 –> New Project –> 其他專案類型 –> 安裝和佈署->InstallShiels Limited Edition Project勾選第一個輸入剛才原廠寄給你的啟動碼(check E-mail for serial number)
me1237guy 發表在 痞客邦 留言(0) 人氣(99)

using Microsoft.Win32;起始位置: WindowsDefaultLocationregedit
1: private void Form1_Load(object sender, EventArgs e)
2: { 3: RegistryKey rkey1, rkey2; //宣告註冊表物件
4: rkey1 = Registry.CurrentUser; //取得目前用戶註冊表項
5: try
6: { 7: rkey2 = rkey1.CreateSubKey("Software\\MySoft"); 8: this.Location = new Point( Convert.ToInt16(rkey2.GetValue("x")), Convert.ToInt16(rkey2.GetValue("y")) ); 9: }
10: catch(Exception exc)
11: { 12: MessageBox.Show(exc.ToString());
13: }
14: }
15:
16: private void Form1_FormClosed(object sender, FormClosedEventArgs e)
17: { 18: RegistryKey rkey1, rkey2;
19: rkey1 = Registry.CurrentUser;
20: try
21: { 22: rkey2 = rkey1.CreateSubKey("Software\\MySoft"); 23: rkey2.SetValue("x", this.Location.X.ToString()); 24: rkey2.SetValue("y", this.Location.Y.ToString()); 25: }
26: catch
27: { 28: }
29: }
me1237guy 發表在 痞客邦 留言(0) 人氣(38)

1: class StaffInfo<T>
2: { 3: public T Num;
4: public T Name;
5: public T Sex;
6: public T Age;
7: public T Birth;
8: public T Salary;
9: }
me1237guy 發表在 痞客邦 留言(0) 人氣(243)

1: class Operation
2: { 3: public virtual double operation(int x, int y)
4: { 5: return x * y;
6: }
7: }
8: class Addition : Operation
9: { 10: public override double operation(int x, int y)
11: { 12: return (x + y);
13: }
14: }
15:
16: private void button1_Click(object sender, EventArgs e)
17: { 18: if (comboBox1.SelectedIndex == 0)
19: { 20: Operation multiplication = new Operation();
21: txtResult.Text = multiplication.operation( Convert.ToInt32(txtNum1.Text.Trim()), Convert.ToInt32(txtNum2.Text.Trim() )).ToString();
22: }
23: else
24: { 25: Operation addition = new Addition();
26: txtResult.Text = addition.operation(Convert.ToInt32(txtNum1.Text.Trim()), Convert.ToInt32(txtNum2.Text.Trim())).ToString();
27: }
28: }
me1237guy 發表在 痞客邦 留言(0) 人氣(33)

Define an abstract class named Poly
1: public abstract class Poly
2: { 3: private int r = 0;
4: public int R
5: { 6: get
7: { 8: return r;
9: }
10: set
11: { 12: r = value;
13: }
14: }
15: public abstract double Area();
16: }
me1237guy 發表在 痞客邦 留言(0) 人氣(28)

相關文章:
C# Delegates with Anonymous Methods(匿名方法)and Named Methods(具名方法)
框架如下
me1237guy 發表在 痞客邦 留言(0) 人氣(471)

1: class test
2: { 3: public override string ToString()
4: { 5: return "c# 真好用";
6: }
7: }
me1237guy 發表在 痞客邦 留言(0) 人氣(27)