113. 트리뷰(TreeView)
.NET프로그래밍/WinForm 2009. 8. 28. 16:15 |* 트리뷰(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 편집기"로 편집
'.NET프로그래밍 > WinForm' 카테고리의 다른 글
115. 탭 컨트롤(TabControl) (0) | 2009.08.31 |
---|---|
114. 리스트뷰(ListView)와 트리뷰(TreeView)를 이용해서 간단한 윈도우탐색기 만들기 (0) | 2009.08.28 |
112. 리스트뷰(ListView) (0) | 2009.08.28 |
111. PictureBox와 OpenFileDialog를 이용하여 간단한 이미지뷰어(ImageViewer) 만들기 (0) | 2009.08.28 |
110. 체크리스트박스(CheckedListBox) (0) | 2009.08.28 |