public static class NativeMethods
{
public static int WM_SETREDRAW = 0x000B; //uint WM_SETREDRAW
public static int WS_EX_COMPOSITED = 0x02000000;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); //UInt32 Msg
}
class DoubleBufferTableLayoutPanel : TableLayoutPanel
{
public DoubleBufferTableLayoutPanel()
{
SetStyle(ControlStyles.DoubleBuffer, true);
}
protected override void OnCreateControl()
{
base.OnCreateControl();
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.CacheText, true);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= NativeMethods.WS_EX_COMPOSITED;
return cp;
}
}
public void BeginUpdate()
{
NativeMethods.SendMessage(this.Handle, NativeMethods.WM_SETREDRAW, IntPtr.Zero, IntPtr.Zero);
}
public void EndUpdate()
{
NativeMethods.SendMessage(this.Handle, NativeMethods.WM_SETREDRAW, new IntPtr(1), IntPtr.Zero);
Parent.Invalidate(true);
}
}
DoubleBufferTableLayoutPanel 이것을 쓴다.
'c# > WinForm' 카테고리의 다른 글
| WinForm) Transfer Data From Form to Form ( 폼과 폼간에 데이터를 전송하는 소스) (0) | 2018.09.19 |
|---|---|
| WinForm HorizontalScroll False 하는 방법..스크롤 이슈 (0) | 2018.09.18 |
| TableLayoutPanel 마우스 스크롤 (0) | 2018.09.07 |
| WinForm Tab내에 새로운 Form 띄우기 (0) | 2018.09.06 |
| [C#] Windows Form(WinForm) Listview Flickering 깜박임 줄이기 (0) | 2018.08.14 |


