how to draw custom border, Actually i'am trying to draw 1 pixels border but failed, how can we achieve this? i had tried this.but failed.i tried like this it works fine when window does't have child window .. in my case on top of my window there are 3 child window on this case i'am getting flickering.
case WM_NCACTIVATE :
{
if(TRUE == wParam)
{
stateofWindow = true;
InvalidateRect(hwnd,NULL,true);
}
else if(FALSE == wParam )
{
stateofWindow = false;
InvalidateRect(hwnd,NULL,true);
}
}
break;
case WM_NCCALCSIZE :
{
if (true == wParam )
{
return 0;
}
}
break;
case WM_PAINT:
{
HDC hcd = NULL;
PAINTSTRUCT ps;
hcd = BeginPaint(hwnd,&ps);
HPEN hPen = CreatePen(PS_SOLID, 1, RGB(165,165,165));;
SelectObject(hcd, hPen);
RECT rcClientRect = {0};
GetClientRect(hwnd,&rcClientRect);
//GetWindowRect(hwnd,&rcClientRect);
if(FALSE == stateofWindow)
{
MoveToEx(hcd,rcClientRect.left,rcClientRect.top,NULL);
LineTo(hcd,rcClientRect.right-1,rcClientRect.top );
LineTo(hcd,rcClientRect.right-1,rcClientRect.bottom-1 );
LineTo(hcd,rcClientRect.left,rcClientRect.bottom-1 );
LineTo(hcd,rcClientRect.left,rcClientRect.top);
}
else
{
HPEN hPen1 = CreatePen(PS_SOLID, 1, RGB(255,0,0));;
SelectObject(hcd, hPen1);
MoveToEx(hcd,rcClientRect.left,rcClientRect.top,NULL);
LineTo(hcd,rcClientRect.right-1,rcClientRect.top );
LineTo(hcd,rcClientRect.right-1,rcClientRect.bottom-1 );
LineTo(hcd,rcClientRect.left,rcClientRect.bottom-1 );
LineTo(hcd,rcClientRect.left,rcClientRect.top);
}
EndPaint(hwnd,&ps);
}
break;