posts - 124,  comments - 29,  trackbacks - 0
     摘要:  class ReadExcelToTree    {        public ReadExcelToTree()        {   ...  阅读全文
posted @ 2008-09-19 20:25 天书 阅读(986) | 评论 (0)编辑 收藏
     摘要: 有大小写匹配和向上搜索的功能作为参数传进去类里面的成员变量有:        private TextBox tb;        private int findCount = 0;      &n...  阅读全文
posted @ 2008-09-19 10:35 天书 阅读(1294) | 评论 (0)编辑 收藏
设置该窗体的  TopMost 改为true;  ShowInTaskbar改为false
posted @ 2008-09-17 21:03 天书 阅读(825) | 评论 (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 天书 阅读(313) | 评论 (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 天书 阅读(647) | 评论 (0)编辑 收藏
要想哪个textbox 获得焦点,把它的TabStop属性设为True 即可。
我试过 :TabIndex = 0 ; textbox.foucs(); 都没用啊都获不得焦点不知道怎么搞的,把我想设焦点的textbox 的属性TabStop设为True ,出现了想要的结果呵呵!不过目前还不知道为什么呢......
posted @ 2008-09-14 12:16 天书 阅读(3017) | 评论 (2)编辑 收藏
     摘要:   1using System;  2using System.Collections.Generic;  3using System.ComponentModel;  4using System.Data;  5using System.Drawi...  阅读全文
posted @ 2008-09-12 16:52 天书 阅读(2068) | 评论 (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 天书 阅读(832) | 评论 (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 天书 阅读(937) | 评论 (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 天书 阅读(1893) | 评论 (0)编辑 收藏
仅列出标题
共13页: First 4 5 6 7 8 9 10 11 12 Last 

<2008年10月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用链接

留言簿(5)

随笔档案

文章分类

文章档案

好友的Bolg

搜索

  •  

最新评论

阅读排行榜

评论排行榜