DevExpress
컨트롤을 사용 하고 있습니다. 나는 GridControl
열이 CheckboxRepository
있습니다. 열에 체크 박스 (텍스트 + 체크 박스)가있는 텍스트를 표시하고 싶습니다. 어떻게 할 수 있습니까?
살펴보기 : 동일한 셀 내의 확인란 옆에 사용자 지정 텍스트를 표시하는 방법
이 작업은 다음 GridView / TreeList 이벤트를 처리하여 수행 할 수 있습니다. CustomDrawCell 이벤트 (TreeList 컨트롤의 경우 CustomDrawNodeCell) 및 ShownEditor 이벤트입니다. CustomDraw ~ 이벤트 내에서 확인란과 필요한 캡션을 그려야합니다.
private void treeList1_CustomDrawNodeCell(object sender, DevExpress.XtraTreeList.CustomDrawNodeCellEventArgs e)
{
if (e.Column != treeList1.Columns["Check"])
return;
string caption = "Node ID: " + e.Node.Id.ToString();
DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo viewInfo = (e.EditViewInfo as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo);
DevExpress.Utils.Drawing.CheckObjectInfoArgs checkInfo = viewInfo.CheckInfo;
checkInfo.Caption = caption;
checkInfo.Graphics = e.Graphics;
viewInfo.CheckPainter.CalcObjectBounds(checkInfo);
}
ShownEditor 이벤트 핸들러는 에디터가 활성화 될 때 에디터의 Properties.Caption 속성을 조정해야합니다 :
private void treeList1_ShownEditor(object sender, System.EventArgs e)
{
DevExpress.XtraTreeList.TreeList tl = sender as DevExpress.XtraTreeList.TreeList;
if (tl.FocusedColumn != tl.Columns["Check"])
return;
(tl.ActiveEditor as DevExpress.XtraEditors.CheckEdit).Properties.Caption = "Node ID: " + tl.FocusedNode.Id.ToString();
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다