* 트리뷰(TreeView)는 윈도우 탐색기의 좌측에 위치해 있는 부분을 말한다.

'도구상자'의 '모든 Windows Forms'에서 "TreeView"를 폼에 드래그 & 드롭 --> "Nodes"속성에 들어가서 "TreeNode 편집기"로 편집("루트추가"/"자식추가"/각 노드의 "Text"속성에 텍스트입력)


==> Program.cs



using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace MyWinForms
{
    static class Program
    {
        /// <summary>
        /// 해당 응용 프로그램의 주 진입점입니다.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Controls.FrmTreeView());
        }
    }
}




==============================================================================================




==> FrmTreeView.cs



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MyWinForms.Controls
{
    public partial class FrmTreeView : Form
    {
        public FrmTreeView()
        {
            InitializeComponent();
        }

        private void FrmTreeView_Load(object sender, EventArgs e)
        {
            //
            this.treeView1.Nodes[0].Nodes[1].Nodes.Add("Program");
            this.treeView1.Nodes[0].Nodes[1].Nodes[0].Nodes.Add("SQL");
        }
    }
}





< 실행결과 >

--> "TreeView"의 "Nodes"속성에 들어가서 "TreeNode 편집기"로 편집












Posted by holland14
: