본문 바로가기
C#/DevExpress

DevExpress / Winform CheckedListBoxItem 컨트롤 추가하기.

by HyunS_ 2019. 4. 15.

여러개의 항목을 선택 및 해제 할 수 있는 CheckedListBoxItem컨트롤을 추가하는 방법 입니다.

 

CheckedListBoxItem[] items = {
                                 new CheckedListBoxItem("January", false),
                                 new CheckedListBoxItem("February", false),
                                 new CheckedListBoxItem("March", true),
                                 new CheckedListBoxItem("April", false),
                                 new CheckedListBoxItem("May", false),
                                 new CheckedListBoxItem("June", true),
                                 new CheckedListBoxItem("July", true),
                                 new CheckedListBoxItem("August", false),
                                 new CheckedListBoxItem("September", false),
                                 new CheckedListBoxItem("October", false),
                                 new CheckedListBoxItem("November", false),
                                 new CheckedListBoxItem("December", false)
                              };
CreateCheckedListBoxControl(items);

private void CreateCheckedListBoxControl(CheckedListBoxItem[] items)
{
      CheckedListBoxControl checkedListBoxControl = new CheckedListBoxControl();
      Controls.Add(checkedListBoxControl);
      checkedListBoxControl.Left = 20;
      checkedListBoxControl.Top = 20;
      checkedListBoxControl.Width = 200;
      checkedListBoxControl.Height = 150;
      checkedListBoxControl.Items.AddRange(items);

}
728x90

댓글