■ DevExpress 그리드 컨트롤을 상속하는 방법을 보여준다.
DevExpress 그리드 컨트롤을 상속해 새로운 컨트롤을 만드는 경우 디자이너 모드에서 해당 뷰들을 변경할 수 있어야 한다.
따라서 컨트롤 상속시 반드시 지정해야 하는 코드를 아래와 같이 소개하며 파생 컨트롤의 추가 기능은 생략한다.
▶ GridControl 상속 클래스 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
using DevExpress.XtraGrid; using DevExpress.XtraGrid.Registrator; public class DSGridControl : GridControl { protected override void RegisterAvailableViewsCore(InfoCollection infoCollection) { infoCollection.Clear(); infoCollection.Add(new DSGridInfoRegistrator()); infoCollection.Add(new DSBandedGridInfoRegistrator()); infoCollection.Add(new DSAdvBandedGridInfoRegistrator()); } } |
▶ GridInfoRegistrator 상속 클래스 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
using DevExpress.XtraGrid; using DevExpress.XtraGrid.Registrator; using DevExpress.XtraGrid.Views.Base; public class DSGridInfoRegistrator : GridInfoRegistrator { public override string ViewName { get { return "GridView"; } } public override BaseView CreateView(GridControl gridControl) { return new DSGridView(gridControl); } } |
▶ GridView 상속 클래스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
using DevExpress.XtraGrid; using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.Grid; public class DSGridView : GridView { public DSGridView() { } public DSGridView(GridControl gridControl) : base(gridControl) { } protected override GridColumnCollection CreateColumnCollection() { return new DSGridColumnCollection(this); } } |
▶ GridColumnCollection 상속 클래스 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.Base; public class DSGridColumnCollection : GridColumnCollection { public DSGridColumnCollection(ColumnView view) : base(view) { } protected override GridColumn CreateColumn() { return new DSGridColumn(); } } |
▶ GridColumn 상속 클래스
1 2 3 4 5 6 7 8 9 10 |
using DevExpress.XtraGrid.Columns; public class DSGridColumn : GridColumn { public DSGridColumn() : base() { } } |
▶ BandedGridInfoRegistrator 상속 클래스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
using DevExpress.XtraGrid; using DevExpress.XtraGrid.Registrator; using DevExpress.XtraGrid.Views.Base; public class DSBandedGridInfoRegistrator : BandedGridInfoRegistrator { public override string ViewName { get { return "BandedGridView"; } } public override BaseView CreateView(GridControl gridControl) { return new DSBandedGridView(gridControl); } } |
▶ BandedGridView 상속 클래스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
using DevExpress.XtraGrid; using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.BandedGrid; public class DSBandedGridView : BandedGridView { public DSBandedGridView() { } public DSBandedGridView(GridControl gridControl) : base(gridControl) { } protected override GridColumnCollection CreateColumnCollection() { return new DSBandedGridColumnCollection(this); } } |
▶ BandedGridColumnCollection 상속 클래스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.BandedGrid; using DevExpress.XtraGrid.Views.Base; public class DSBandedGridColumnCollection : BandedGridColumnCollection { public DSBandedGridColumnCollection(ColumnView view) : base(view) { } protected override GridColumn CreateColumn() { return new DSBandedGridColumn(); } } |
▶ BandedGridColumn 상속 클래스
1 2 3 4 5 6 7 8 9 10 |
using DevExpress.XtraGrid.Views.BandedGrid; public class DSBandedGridColumn : BandedGridColumn { public DSBandedGridColumn() : base() { } } |
▶ AdvBandedGridInfoRegistrator 상속 클래스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
using DevExpress.XtraGrid; using DevExpress.XtraGrid.Registrator; using DevExpress.XtraGrid.Views.Base; public class DSAdvBandedGridInfoRegistrator : AdvBandedGridInfoRegistrator { public override string ViewName { get { return "AdvBandedGridView"; } } public override BaseView CreateView(GridControl gridControl) { return new DSAdvBandedGridView(gridControl); } } |
▶ AdvBandedGridView 상속 클래스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
using DevExpress.XtraGrid; using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.BandedGrid; public class DSAdvBandedGridView : AdvBandedGridView { public DSAdvBandedGridView() { } public DSAdvBandedGridView(GridControl gridControl) : base(gridControl) { } protected override GridColumnCollection CreateColumnCollection() { return new DSBandedGridColumnCollection(this); } } |