• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            C++ Programmer's Cookbook

            {C++ 基礎(chǔ)} {C++ 高級} {C#界面,C++核心算法} {設(shè)計(jì)模式} {C#基礎(chǔ)}

            在Form中構(gòu)建給定目錄的Treeview

            using ?System;
            using ?System.IO;
            using ?System.Drawing;
            using ?System.Collections;
            using ?System.ComponentModel;
            using ?System.Windows.Forms;
            using ?System.Data;

            namespace ?WindowsApplication
            {
            ????
            /// ? <summary>
            ????
            /// ?Summary?description?for?Form1.
            ????
            /// ? </summary>

            ???? public ? class ?Form1?:?System.Windows.Forms.Form
            ????
            {
            ????????
            private ?System.Windows.Forms.TreeView?treeView1;
            ????????
            /// ? <summary>
            ????????
            /// ?Required?designer?variable.
            ????????
            /// ? </summary>

            ???????? private ?System.ComponentModel.Container?components? = ? null ;

            ????????
            public ?Form1()
            ????????
            {
            ????????????
            //
            ????????????
            // ?Required?for?Windows?Form?Designer?support
            ????????????
            //
            ????????????InitializeComponent();

            ????????????
            //
            ????????????
            // ?TODO:?Add?any?constructor?code?after?InitializeComponent?call
            ????????????
            //
            ????????????Text? = " my?explore " ;
            ????????}


            ????????
            /// ? <summary>
            ????????
            /// ?Clean?up?any?resources?being?used.
            ????????
            /// ? </summary>

            ???????? protected ? override ? void ?Dispose(? bool ?disposing?)
            ????????
            {
            ????????????
            if (?disposing?)
            ????????????
            {
            ????????????????
            if ?(components? != ? null )?
            ????????????????
            {
            ????????????????????components.Dispose();
            ????????????????}

            ????????????}

            ????????????
            base .Dispose(?disposing?);
            ????????}


            ????????
            Windows?Form?Designer?generated?code

            ????????
            private ? void ?Fill(TreeNode?dirNode)?
            ????????
            {

            ????????????DirectoryInfo?dir?
            = ? new ?DirectoryInfo(dirNode.FullPath);
            ????????????
            ????????????
            // ?An?exception?could?be?thrown?in?this?code?if?you?don't
            ????????????
            // ?have?sufficient?security?permissions?for?a?file?or?directory.
            ????????????
            // ?You?can?catch?and?then?ignore?this?exception.
            ???????????? foreach ?(DirectoryInfo?dirItem? in ?dir.GetDirectories())?
            ????????????
            {

            ????????????????
            // ?Add?node?for?the?directory.
            ????????????????TreeNode?newNode? = ? new ?TreeNode(dirItem.Name);
            ????????????????dirNode.Nodes.Add(newNode);
            ????????????????newNode.Nodes.Add(
            " * " );
            ????????????}

            ????????}


            ????????
            /// ? <summary>
            ????????
            /// ?The?main?entry?point?for?the?application.
            ????????
            /// ? </summary>

            ????????[STAThread]
            ????????
            static ? void ?Main()?
            ????????
            {
            ????????????Application.Run(
            new ?Form1());
            ????????}


            ????????
            private ? void ?Form1_Load( object ?sender,?System.EventArgs?e)
            ????????
            {
            ????????????
            // ?Set?the?first?node.
            ????????????TreeNode?rootNode? = ? new ?TreeNode( " C:\\ " );
            ????????????treeView1.Nodes.Add(rootNode);

            ????????????
            // ?Fill?the?first?level?and?expand?it.
            ????????????Fill(rootNode);
            ????????treeView1.Nodes[
            0 ].Expand();

            ????????}


            ????????
            private ? void ?treeView1_BeforeExpand( object ?sender,?System.Windows.Forms.TreeViewCancelEventArgs?e)
            ????????
            {
            ????????????
            // ?If?a?dummy?node?is?found,?remove?it?and?read?the?
            ????????????
            // ?real?directory?list.
            ???????????? if ?(e.Node.Nodes[ 0 ].Text? == ? " * " )?
            ????????????
            {

            ????????????????e.Node.Nodes.Clear();
            ????????????????Fill(e.Node);
            ????????????}

            ????????}

            ????}

            }

            posted on 2006-03-23 17:15 夢在天涯 閱讀(514) 評論(0)  編輯 收藏 引用 所屬分類: C#/.NET

            公告

            EMail:itech001#126.com

            導(dǎo)航

            統(tǒng)計(jì)

            • 隨筆 - 461
            • 文章 - 4
            • 評論 - 746
            • 引用 - 0

            常用鏈接

            隨筆分類

            隨筆檔案

            收藏夾

            Blogs

            c#(csharp)

            C++(cpp)

            Enlish

            Forums(bbs)

            My self

            Often go

            Useful Webs

            Xml/Uml/html

            搜索

            •  

            積分與排名

            • 積分 - 1804303
            • 排名 - 5

            最新評論

            閱讀排行榜

            久久久久久久97| 久久久精品国产Sm最大网站| 久久精品麻豆日日躁夜夜躁| 亚洲精品高清国产一久久| 欧美国产精品久久高清| 九九久久自然熟的香蕉图片| 久久久无码精品亚洲日韩软件| 国产色综合久久无码有码| 国内精品久久国产大陆| 亚洲伊人久久综合影院| 91久久精品视频| 午夜不卡久久精品无码免费| 久久99亚洲综合精品首页| 欧美熟妇另类久久久久久不卡| 精品久久人人妻人人做精品| 日韩久久久久久中文人妻| 日本亚洲色大成网站WWW久久 | 久久人人爽人人爽人人片av麻烦| 国产精品久久久久久福利漫画| 香蕉久久久久久狠狠色| 久久精品国产99国产电影网| 亚洲愉拍99热成人精品热久久| 久久久受www免费人成| 91精品国产91久久久久久| 2020久久精品国产免费| 午夜精品久久久久久毛片| 久久99九九国产免费看小说| 成人a毛片久久免费播放| 久久久久四虎国产精品| 99久久无色码中文字幕 | 久久中文字幕视频、最近更新| 国产精品久久成人影院| 久久精品a亚洲国产v高清不卡| 久久久久人妻一区二区三区| 午夜精品久久久内射近拍高清 | 女同久久| 久久影视综合亚洲| 伊人久久一区二区三区无码| 久久综合伊人77777| 亚洲国产综合久久天堂| 久久性生大片免费观看性|