첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

TestProject.zip
0.01MB

▶ MainForm.cs

using System.Reflection;
using System.Windows.Forms;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : Form
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            this.listView.View            = View.Details;
            this.listView.MultiSelect     = false;
            this.listView.GridLines       = true;
            this.listView.FullRowSelect   = true;
            this.listView.HideSelection   = false;
            this.listView.VirtualMode     = true;
            this.listView.VirtualListSize = 100_000_000;

            PropertyInfo property = typeof(ListView).GetProperty("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance);

            property.SetValue(this.listView, true, null);

            this.listView.RetrieveVirtualItem += listView_RetrieveVirtualItem;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region 리스트 뷰 가상 항목 가져오기 - listView_RetrieveVirtualItem( sender, e)

        /// <summary>
        /// 리스트 뷰 가상 항목 가져오기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void listView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            ListViewItem item = new ListViewItem();

            item.Text = $"학생 {e.ItemIndex:#,##0}";

            ListViewItem.ListViewSubItem subsidaryItem = new ListViewItem.ListViewSubItem();

            subsidaryItem.Text = $"학교 {e.ItemIndex:#,##0}";

            item.SubItems.Add(subsidaryItem);

            e.Item = item;
        }

        #endregion
    }
}
728x90
그리드형(광고전용)
Posted by icodebroker
,