protected override unsafe void WndProc(ref Message m)
{
if (m.Msg == (int) WindowMessage.WM_NCPAINT)
{
try
{
RenderBorder();
}
catch {}
base.WndProc(ref m);
}
else if (m.Msg == (int) WindowMessage.WM_SHOWWINDOW)
{
if (RunOnce)
{
RunOnce = false;
OnLoad(null);
base.WndProc(ref m);
UpdateStyles();
}
else
{
UpdateStyles();
base.WndProc(ref m);
}
}
else if (m.Msg == (int) WindowMessage.WM_NCCREATE)
{
base.WndProc(ref m);
}
else if (m.Msg == (int) WindowMessage.WM_NCCALCSIZE)
{
if (m.WParam == (IntPtr) 0)
{
var pRC = (APIRect*) m.LParam;
//pRC->left -=3;
base.WndProc(ref m);
}
else if (m.WParam == (IntPtr) 1)
{
var pNCP = (_NCCALCSIZE_PARAMS*) m.LParam;
base.WndProc(ref m);
int t = pNCP->NewRect.top + BorderWidth;
int l = pNCP->NewRect.left + BorderWidth;
int b = pNCP->NewRect.bottom - BorderWidth;
int r = pNCP->NewRect.right - BorderWidth;
pNCP->NewRect.top = t;
pNCP->NewRect.left = l;
pNCP->NewRect.right = r;
pNCP->NewRect.bottom = b;
}
}
else
{
base.WndProc(ref m);
}
}