using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

...

/// <summary>
/// 메시지 보내기
/// </summary>
/// <param name="windowHandle">윈도우 핸들</param>
/// <param name="message">메시지</param>
/// <param name="wParam">WORD 파리미터</param>
/// <param name="lParam">LONG 파라미터</param>
/// <returns>처리 결과</returns>
[DllImport("User32.dll")]
public static extern Int64 SendMessage(IntPtr windowHandle, uint message, IntPtr wParam, IntPtr lParam);

...

/// <summary>
/// WM_PAINT
/// </summary>
private const int WM_PAINT = 0x000f;

...

#region ForcePaint(form)

/// <summary>
/// 강제로 칠하기
/// </summary>
/// <param name="form">폼</param>
public void ForcePaint(Form form)
{
    SendMessage(form.Handle, WM_PAINT, IntPtr.Zero, IntPtr.Zero);
}

#endregion

+ Recent posts