DevExpress XtraGrid RepositoryItemRichTextEdit AutoHeight by Enter Key

Published Jul 7, 2015 | Updated Sep 27, 2022 | 0 comments

Grid 에서 RichEdit  쓸때 엔터키로 높이 자동 조절…

// GridVIew 행 높이 자동 조절 활성화
gvMain.OptionsView.RowAutoHeight = true;

// 특정 컬럼에 Editor 를 할당
RepositoryItemRichTextEdit mEdit = new RepositoryItemRichTextEdit();
mEdit.KeyUp += mEdit_KeyUp;
this.gvMain.Columns["REMARK"].ColumnEdit = mEdit;

// 엔터키 입력시 Editor 를 Close 함으로써 그리드가 행 높이를 자동 조절하게 하고
// 다시 Editor 를 활성화해서 이전에 입력한 Caret 위치를 복원해준다
void mEdit_KeyUp(object sender, KeyEventArgs e)
{
 if (e.KeyCode == (Keys.Enter))
 {
 RichTextEdit editor = (RichTextEdit)sender;
 PropertyInfo myPropertyInfo1 = editor.GetType().GetProperty("InnerControl", BindingFlags.NonPublic | BindingFlags.Instance);
 RichEditControl control = myPropertyInfo1.GetValue(editor, null) as RichEditControl;
 DevExpress.XtraRichEdit.API.Native.DocumentPosition prevPos = control.Document.CaretPosition;

 gvMain.CloseEditor();
 gvMain.ShowEditor();

 control.Document.CaretPosition = prevPos;
 }
}


Learn more on this topic

Related Blog Posts

Blazor 에서 이동 가능한 div 구현(모바일 지원)

Blazor 에서 이동 가능한 div 구현(모바일 지원)

blazor 에서 div 엘리먼트를 드래그해서 이동할 수 있는 기능을 javascript 가 아닌 c# 코드로 구현해 보겠습니다. 또한, 데스크탑 브라우저 뿐만 아니라 모바일 디바이스도 적용 가능하게 수정합니다.

read more

Join in the conversation

Leave a Comment

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

무료 온라인 전광판

전광판

텍스트를 입력하고 텍스트 효과 및 배경효과 를 변경해서 전체화면으로 표시할 수 있는 전광판 용도로 사용하실 수 있습니다. 각종 스포츠 및 공연 관람시 응원 용도로 사용이 가능합니다.

Carousel

여러개의 슬라이드를 추가하여 프레젠테이션 및 이미지 슬라이드 용도로 사용하실 수 있습니다. 브라우저가 포함된 IT 기기로 큰 모니터에 연결하여 매장 내 공지사항 및 메뉴소개를 이미지로 표시할 수 있습니다.

Pin It on Pinterest

Shares
Share This

Share This

Share this post with your friends!

Shares