摘要: class ReadExcelToTree { public ReadExcelToTree() {  ...
閱讀全文
posted @
2008-09-19 20:25 天書 閱讀(1009) |
評論 (0) |
編輯 收藏
摘要: 有大小寫匹配和向上搜索的功能作為參數傳進去類里面的成員變量有: private TextBox tb; private int findCount = 0; &n...
閱讀全文
posted @
2008-09-19 10:35 天書 閱讀(1315) |
評論 (0) |
編輯 收藏
設置該窗體的 TopMost 改為true; ShowInTaskbar改為false
posted @
2008-09-17 21:03 天書 閱讀(852) |
評論 (0) |
編輯 收藏
class{
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
SolidBrush brush = new SolidBrush(Color.DarkRed);
Pen pen = new Pen(brush);
foreach (Point pt in breakPointList)
{
g.DrawEllipse(new Pen(brush), pt.X-6, pt.Y-6, 12, 12);
g.FillEllipse(brush, pt.X - 6, pt.Y - 6, 12, 12);
}
}
List<Point> breakPointList = new List<Point>();
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
breakPointList.Add(new Point(e.X, e.Y));
this.pictureBox1.Refresh(); //引發Paint 函數
}
}
posted @
2008-09-16 20:30 天書 閱讀(322) |
評論 (0) |
編輯 收藏
字體對話框,包括字體和字體顏色的設置 FontDialog fd = new FontDialog();
fd.ShowColor = true; fd.Font = txtCmdInput.Font;
fd.Color = txtCmdInput.ForeColor;
if(fd.ShowDialog()!= DialogResult.Cancel)
{
txtCmdInput.Font = fd.Font;
txtCmdInput.ForeColor = fd.Color;
}
顏色對話框,設置控件背景色 ColorDialog cd = new ColorDialog();
cd.Color = txtCmdInput.BackColor;
if(cd.ShowDialog()!= DialogResult.Cancel)
{
txtCmdInput.BackColor = cd.Color;
}
posted @
2008-09-16 15:21 天書 閱讀(663) |
評論 (0) |
編輯 收藏
要想哪個textbox 獲得焦點,把它的TabStop屬性設為True 即可。
我試過 :TabIndex = 0 ; textbox.foucs(); 都沒用啊都獲不得焦點不知道怎么搞的,把我想設焦點的textbox 的屬性TabStop設為True ,出現了想要的結果呵呵!不過目前還不知道為什么呢......
posted @
2008-09-14 12:16 天書 閱讀(3077) |
評論 (2) |
編輯 收藏
摘要: 1using System; 2using System.Collections.Generic; 3using System.ComponentModel; 4using System.Data; 5using System.Drawi...
閱讀全文
posted @
2008-09-12 16:52 天書 閱讀(2161) |
評論 (1) |
編輯 收藏
C#使用關鍵字class來定義類。其基本結構如下:
class myclass
{
//class members
}
定義這樣一個類后,就可以在能訪問該定義的工程的其他地方對該類進行實例化。
默認情況下,類聲明為內部的,即只有當前工程中的代碼才能訪問它。
可以用internal訪問修飾符關鍵字顯式指定,但這不是必須的,類在定義時默認為此類型的類。
如果將類指定為公共的,應可以由其他工程中的代碼來訪問。使用關鍵字public。(注:這種方式聲明的類不能是私有的private或受保護的protected。可以把這些聲明類的修飾符用于聲明類成員。
在C#中有一個規定:編譯器不允許派生類的可訪問性比其基類更高。也就是說,內部類可以繼承于一個公共類,但公共類不能繼承于一個內部類。
合法的:內部類繼承公共類
public class MyBase
{
//class members
}
internal class MyClass : MyBase
{
//class members
}
不合法的:公共類繼承內部類(編譯器會說可訪問性不一致)
internal class MyBase
{
//class members
}
public class MyClass : MyBase
{
//class members
}
訪問修飾符的訪問性由高到低一次為:public ——> internel ——> protected ——> private
posted @
2008-09-11 20:52 天書 閱讀(845) |
評論 (0) |
編輯 收藏
using System.Net; String
hostInfo =
Dns.GetHostName();
System.Net.IPAddress addr;
addr = new System.
Net.IPAddress(Dns.GetHostByName(Dns.GetHostName()).AddressList[0].Address);
String
IpAddress = addr.ToString();
posted @
2008-09-11 13:54 天書 閱讀(951) |
評論 (0) |
編輯 收藏
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Rendering;
private void StyleChange(object sender, EventArgs e)
{
ButtonItem item = sender as ButtonItem;
if (item == BUTStyle07Blue)
{
// This is all that is needed to change the color table for all controls on the form
ribbonControl1.Office2007ColorTable = eOffice2007ColorScheme.Blue;
}
else if (item == BUTStyle07Black)
{
// This is all that is needed to change the color table for all controls on the form
ribbonControl1.Office2007ColorTable = eOffice2007ColorScheme.Black;
}
else if (item == BUTStyle07Silver)
{
// This is all that is needed to change the color table for all controls on the form
ribbonControl1.Office2007ColorTable = eOffice2007ColorScheme.Silver;
}
this.Invalidate();
}
posted @
2008-09-11 10:54 天書 閱讀(1926) |
評論 (0) |
編輯 收藏