3.通过ADO.NET从数据库中获取架构信息是可以的

解决方案 »

  1.   

    高亮度语法编辑器RichTextBox可以做,也不太费劲,就是闪烁解决不了,哪位兄弟搞定了?
      

  2.   

    1、如何将父类的保护成员到子类中改成公有的成员
       回答:delphi可以这样做,c#不可以,只能变通呀,(老弟应该是vcl出神吧)
    2、如何调用生成ADO连接字符串的对话框
       在oledb哪个com单元里,有显示这个筐的方法。3、如何知道一个oleDbConnection连接的数据库,数据表列表
    (大型数据库很好获取,但对于象Access,Excel,Foxpro,Paradox,Text数据库该如何获取)
      哦,Excel (可以配好连接以后 select * from [sheet1]) 其他access foxpro paradox用oledb方法操作很简单,对于ASCII的表(text) 不知道有没有ole驱动支持,想办法用fileStream读吧
    4、高亮度语法编辑器
        高亮度语法显示,用richtext,对与rtf串,可以用office带的 一个com 给分,我给你说,不骗你呀哈
      

  3.   

    1 如何将父类的保护成员到子类中改成公有的成员
        public class  Test 
        {
            protected string SayHelloTo(string name)
            {
                return "hello," + name;
            }
        }
        public class MyTest : Test
        {
            new public string SayHelloTo(string name)
            {
                return base.SayHelloTo(name);
            }
        }
      

  4.   

    2、如何调用生成ADO连接字符串的对话框using System;using System.Windows.Forms;namespace Whxbb.Windows.Forms
    {
        /// <summary>
        /// 数据库选择对话框。
        /// </summary>
        public class ChooseDatabaseDialog 
        {
            private string _connectionString = String.Empty;
            /// <summary>
            /// 获取数据库连接字符串。
            /// </summary>
            public string ConnectionString
            {
                get 
                { 
                    if (_connectionString == string.Empty && _connectionString != "")
                    {
                        return _connectionString;
                    }
                    else
                    {
                        string[] tmp = _connectionString.Split(';');
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        for(int i = 1; i < tmp.Length; i++)
                        {
                            if (i != 1)
                                sb.Append(";" + tmp[i]);
                            else
                                sb.Append(tmp[i]);
                        }
                        return sb.ToString();
                    }            }
            }        private  MSDASC.DataLinks _dataLinks;
            private ADODB.Connection _connection;        /// <summary>
            /// 无参数构造方法。
            /// </summary>
            public ChooseDatabaseDialog()
            {
                _dataLinks = new MSDASC.DataLinksClass();
            }        /// <summary>
            /// 显示对话框。
            /// </summary>
            /// <returns></returns>
            public DialogResult ShowDialog()
            {
                try
                {
                    _connection = new ADODB.ConnectionClass();
                    //_connection = (ADODB.Connection)_dataLinks.PromptNew();
                    _connection.Provider = "SQLOLEDB.1";                                 object obj = _connection as object;
                    _dataLinks.PromptEdit(ref obj);
                    if (_connection == null)
                    {
                        return DialogResult.Cancel;
                    }
                    else
                    {
                        _connectionString = _connection.ConnectionString;
                        if (_connectionString == "" || _connectionString == null)
                        {
                         
                            return DialogResult.Cancel;
                        }
                        else
                        {
                            return DialogResult.OK;
                        }
                    }
                }
                catch (Exception e)
                {
                    return DialogResult.Abort;
                }           
            }
        }}记得引用 .net程序集adodb 和 com 组件micorsoft ole db service component 1.0 type library。具体用法我自己还在摸索中。
      

  5.   

    3、如何知道一个oleDbConnection连接的数据库,数据表列表public DataTable GetTables(OleDbConnection conn)
    {
      conn.Open();
      DataTable schemaTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
                                                       new object[] {null, null, null, "TABLE"});
      conn.Close();
      return schemaTable;
    }
      

  6.   

    答:如何屏蔽已有控件的可浏览属性,如,你在做一个控件时,
        可以设定属性    [Browsable(false)]?因为控件的可见性是依赖其父控件的可见性的,所以你设置父控件的可见性即可
      

  7.   

    http://www.microsoft.com/china/msdn/library/dndotnet/html/usingpropgrid.asp
      

  8.   

    关于用RichTextBox作代码编辑器基本上不用考虑,一是闪烁,二是效率低下。比较可行的就是用GDI+自己画。
      

  9.   

    谢谢以上各位!
    本来还有一个问题,鼠标活动范围的锁定:今天自己解决了,献丑了:
    using System;
    using System.Windows.Forms;
    using System.Drawing;
    using System.Runtime.InteropServices;
           [StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
    public int left;
    public int top;
    public int right;
    public int bottom;
    }
             public class Common
    {
    [DllImport("User32.dll", CharSet=CharSet.Auto)]
    public static extern bool ClipCursor(ref RECT lpRect);
                      
                      /// <summary>
    /// 使鼠标在指定的范围内活动
    /// </summary>
    /// <param name="C"></param>
    public static void ClipCursorIn(System.Windows.Forms.Control C)
    {

    Crownwood.Magic.Win32.RECT R;
    Point P=C.PointToScreen(C.Location);
    R.left=P.X;
    R.top=P.Y;
    R.right=R.left+C.Width;
    R.bottom=R.top+C.Height;
    ClipCursor(ref R);
    }
    /// <summary>
    /// 恢复鼠标的活动范围
    /// </summary>
    public static void RestoreCursor()
    {
    Crownwood.Magic.Win32.RECT R;
    //Point P=
    R.left=0;
    R.top=0;
    R.right=Screen.PrimaryScreen.Bounds.Width;
    R.bottom=Screen.PrimaryScreen.Bounds.Height;
    ClipCursor(ref R);
    }
    }