int flag  = 0;

void PaintBox4OnPaint(tWidget *pWidget, tContext *pContext)
{

     switch(flag)
     {
     case 0 :   hmi_SetForeground(pContext , 0xFFFFFF );
                hmi_FillRect(pContext, 0, 0, 240, 197);
                break ;

     case 1 :   hmi_DrawRect( pContext , 90 , 160 , 180 ,221 );
                break ;

     case 2 :   hmi_SetForeground(pContext , 0xFFFFFF);
                hmi_FillRect(pContext , 0 , 0 ,240 , 320);
                break ;

     case 3 :   hmi_DrawCircle(pContext , 120 , 221 , 50 );
                break;

     case 4 :   hmi_SetForeground(pContext , 0xFFFFFF);
                hmi_FillRect(pContext , 0 , 0 , 240 , 320);
                break ;

     case 5 :   hmi_DrawEllipse(pContext ,  50 , 160, 200 ,221);
                break ;

     case 6 :   hmi_SetForeground(pContext , 0xFFFFFF);
                hmi_FillRect(pContext , 0 , 0 , 240 , 320);
                break ;

     case 7 :   hmi_SetForeground(pContext , 0xFFCC33);
                hmi_FillRect(pContext , 90 , 160, 180,221);
                break ;

     case 8 :   hmi_SetForeground(pContext , 0xFFFFFF);
                hmi_FillRect(pContext , 0 , 0 , 240 , 320);
                break ;

     case 9 :   hmi_SetForeground(pContext , 0x6666FF);
                hmi_FillCircle(pContext , 120 , 221,50 );
                break;

     case 10 :  hmi_SetForeground(pContext , 0xFFFFFF);
                hmi_FillRect(pContext , 0 , 0 , 240 , 320);
                break ;

     case 11 :  hmi_SetForeground(pContext , 0x888888);
                hmi_FillEllipse(pContext , 50 , 160, 200 ,221);
                break ;

     default:   hmi_SetForeground(pContext , 0xFFFFFF );
                hmi_FillRect(pContext, 0, 0, 240, 320);
     }
}



void BitButton8OnClick(tWidget *pWidget)
{
    if(flag > 11)
     {
      flag = 0 ;
     }

     WidgetPaint((tWidget*)&PaintBox4);
     flag++;

}

