Devexpress Ribbon의 TabView를 사용하고 Child Form 에서 일정 수량 이상( TextEdit 기준 100~150개 이상 )의 Control이 존재 하는 경우 Tab Change 시에 일시적으로 느려지는 현상이 있습니다. (Tab Header)
(1항 작성 후 2항 혹은 3항 두가지 중 하나를 적용해 주시면 됩니다.)
1. 확장 함수 사용
------------------------------ [DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
private const int WM_SETREDRAW = 11;
public static void SuspendDrawing(this Control Target)
{
SendMessage(Target.Handle, WM_SETREDRAW, false, 0);
}
public static void ResumeDrawing(this Control Target)
{
SendMessage(Target.Handle, WM_SETREDRAW, true, 0);
Target.Invalidate(true);
Target.Update();
Application.DoEvents();
}
------------------------------ ------------------------------ ------------
2. Child Form에 override OnActivated 추가
------------------------------ ------------------------------ ------------
protected override void OnActivated(EventArgs e)
{
this.SuspendDrawing();
base.OnActivated(e);
}
------------------------------ ------------------------------ ------------
3. Child Form에 Activated 이벤트 추가
------------------------------ ------------------------------ ------------
private void Form_Activated(object sender, EventArgs e)
{
this.ResumeDrawing();
}
------------------------------ ------------------------------ ------------
C#에서 지원하는 SuspendLayout, ResumeLayout 이 일부에서 작동하지 않는 다는 이야기가 있어 확장 함수를 추가 하여 발송합니다.
간단한 샘플도 함께 첨부
------------------------------ ------------------------------ ---------
Form1, Form2, Form3 을 오픈 하면 50개의 TextEdit가 추가 되어 있습니다.
Form 내부를 클릭시 마다 50개의 컨트롤이 추가 됩니다.
Form 내부를 클릭시 마다 50개의 컨트롤이 추가 됩니다.
Enable Func를 체크/체크해제 하여 테스트 진행하시면 됩니다.
------------------------------ ------------------------------ ---------
'.Net Framework Standard > Component' 카테고리의 다른 글
Devexpress GridContro/ TreeList Indicator Header에 버튼 추가 (0) | 2024.07.03 |
---|---|
[Devexpress] TreeListControl - Raise AfterCheckNode / BeforeCheckNode (0) | 2024.05.10 |
Devexpress TreeList Multiple FooterRow - CustomDrawFooterCell (0) | 2024.01.30 |
[Devexpress] BandedGridView에서 Header가 너무 긴 경우 Caption 표시 (0) | 2024.01.15 |