In my Main_OnPaint
static void Main_OnPaint(HWND hwnd)
{
PAINTSTRUCT ps;
RECT rc;
HDC hdc; // HANDLE TO DEVICE CONTEXT FOR GRAPHICS
HPEN hpen_ThinBlack,hpenOld; // pen handles
int xcount=0; // keeping count of drawing operations
int startpointx,startpointy; // point at which to start drwaing
int curx,cury,curwidth,curhite; // current point in drawing
int scaledw,scaledh; // scaled width and hite
GetClientRect(hwnd, &rc);
BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps); // if i dont d this i cant get about dialog to dissapear
if (g_bmydrawmode==TRUE)
{
PAINTSTRUCT ps;
hdc=BeginPaint(hwnd, &ps);
hpen_ThinBlack=CreatePen(PS_SOLID,2, RGB(139, 35, 35)); // thin black pen
hpenOld=SelectObject(hdc, hpen_ThinBlack); // remember the old pen
SelectObject(hdc,hpen_ThinBlack);
Rectangle(hdc,startpointx,startpointy, startpointx+scaledw,startpointy+scaledh);
do{
xcount++;
switch (g_iframepartid[xcount]) // going through the already entered input
{
case TOP:
Rectangle(hdc,startpointx+10,startpointy+10, startpointx+scaledw,startpointy+scaledh);
break;
case LEFT:
Rectangle(hdc,startpointx,startpointy, startpointx+scaledw,startpointy+scaledh);
break;
case RIGHT:
Rectangle(hdc,startpointx,startpointy, startpointx+scaledw,startpointy+scaledh);
break;
}// end of switch
}
while (xcount<g_ipartidcount );
//put back original pen and destroy one i have finished with
SelectObject(hdc, hpenOld);
DeleteObject(hpen_ThinBlack);
EndPaint(hwnd, &ps);
}// end of if
} //end of func
In my Main_OnCommand(......
I have this
case IDC_NEXTDRAWBUT :
g_bmydrawmode=TRUE;
RedrawWindow(hwnd,NULL,NULL, RDW_INTERNALPAINT |
RDW_ALLCHILDREN | RDW_INVALIDATE);
UpdateWindow(hwnd);
g_bmydrawmode=FALSE;
Having tried every variation i can think of
from UpdateWindow to Redraw and others i cannot get my NEXTDRAWBUTTON to
fire a WM_PAINT
However if i call up an about dialog. After this clears the rectangle is shown.
in fact any other window like messagebox that appears over the drawing that has been executed but not shown will make drawing appear when said box is closed.
but i cant for the life of me work out where i am going wrong
so any help would be appreciated.