• <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è)計模式} {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 夢在天涯 閱讀(515) 評論(0)  編輯 收藏 引用 所屬分類: C#/.NET

            公告

            EMail:itech001#126.com

            導(dǎo)航

            統(tǒng)計

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

            常用鏈接

            隨筆分類

            隨筆檔案

            收藏夾

            Blogs

            c#(csharp)

            C++(cpp)

            Enlish

            Forums(bbs)

            My self

            Often go

            Useful Webs

            Xml/Uml/html

            搜索

            •  

            積分與排名

            • 積分 - 1804603
            • 排名 - 5

            最新評論

            閱讀排行榜

            91精品免费久久久久久久久| 人妻无码中文久久久久专区| 久久精品人人做人人爽97| 2020国产成人久久精品| 久久精品亚洲男人的天堂| 国产L精品国产亚洲区久久| 久久噜噜电影你懂的| 久久综合九色综合精品| 国产精品va久久久久久久| 99久久国产热无码精品免费久久久久| 久久免费精品一区二区| 国产69精品久久久久9999| 久久亚洲国产精品五月天婷| 日韩欧美亚洲国产精品字幕久久久 | 亚洲狠狠婷婷综合久久久久| 18禁黄久久久AAA片| 亚洲AV无码久久寂寞少妇| 国产精品久久久久久久| 国产精品99久久久久久宅男| 日韩久久无码免费毛片软件| 亚洲午夜无码久久久久| 伊人久久免费视频| 中文字幕无码久久人妻| 久久国产精品成人影院| 99久久亚洲综合精品网站| 日韩精品无码久久一区二区三| 少妇精品久久久一区二区三区| 99久久无色码中文字幕| 久久伊人精品青青草原日本| 久久久亚洲欧洲日产国码是AV| 久久精品国产99国产精品澳门| 精品久久久久久久中文字幕| 久久人人添人人爽添人人片牛牛| 国产91久久精品一区二区| 欧美一级久久久久久久大| 精品久久久久久中文字幕人妻最新| 九九热久久免费视频| 久久久久人妻精品一区| 狠狠色丁香久久婷婷综合_中 | 97久久超碰国产精品2021| 久久综合久久伊人|