增强μC/GUI-v3.90a下2色scrollbar显示效果
2色下scrollbar显示效果不太理想,做如下修改可以使显示效果提高一些, 效果图: //1.向scrollbar.c添加头文件 #include "LCDConf.h" //2.修改scrollbar.c->_Paint()函数 static void _Paint(SCROLLBAR_Obj* pObj) { int ArrowSize, ArrowOff; SCROLLBAR_POSITIONS Pos; GUI_RECT r, rClient; /* Get / calc position info */ _CalcPositions(pObj, &Pos); WIDGET__GetClientRect(&pObj->Widget, &rClient); r = rClient; //2007-09-14 gliethttp 单色屏支持 #if (LCD_BITSPERPIXEL == 1) LCD_SetColor(GUI_BLACK); GUI_Clear(); #endif ArrowSize = ((r.y1 - r.y0) /3) - 1; ArrowOff = 3 + ArrowSize+ ArrowSize/3; /* Draw left Arrow */ LCD_SetColor(pObj->aColor[0]); r = rClient; r.x0 = Pos.x0_LeftArrow; r.x1 = Pos.x1_LeftArrow; WIDGET__FillRectEx(&pObj->Widget, &r); LCD_SetColor(pObj->aBkColor[1]); _DrawTriangle(&pObj->Widget, r.x0 + ArrowOff, (r.y1 - r.y0) >> 1, ArrowSize, -1); //2007-09-14 gliethttp 单色屏支持 WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &r); /* Draw the thumb area which is not covered by the thumb */ #define LCD_BITSPERPIXELF 1 #if (LCD_BITSPERPIXEL == 1) && LCD_BITSPERPIXELF LCD_SetColor(GUI_BLACK); #else LCD_SetColor(pObj->aBkColor[0]); #endif r.x0 = Pos.x1_LeftArrow + 1; r.x1 = Pos.x0_Thumb - 1; WIDGET__FillRectEx(&pObj->Widget, &r); r = rClient; r.x0 = Pos.x1_Thumb + 1; r.x1 = Pos.x0_RightArrow - 1; WIDGET__FillRectEx(&pObj->Widget, &r); /* Draw Thumb */ r = rClient; r.x0 = Pos.x0_Thumb; r.x1 = Pos.x1_Thumb; #if (LCD_BITSPERPIXEL == 1) && LCD_BITSPERPIXELF { LCD_SetColor(GUI_WHITE); if (pObj->Widget.State & WIDGET_STATE_VERTICAL) WIDGET__RotateRect90(&pObj->Widget, &r, &r); r.x0+=3; r.x1-=3; r.y0-=1; GUI_FillRectEx(&r); r = rClient;//恢复 } #else LCD_SetColor(pObj->aColor[0]); WIDGET__FillRectEx(&pObj->Widget, &r); #endif WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &r); /* Draw right Arrow */ LCD_SetColor(pObj->aColor[0]); r.x0 = Pos.x0_RightArrow; r.x1 = Pos.x1_RightArrow; WIDGET__FillRectEx(&pObj->Widget, &r); LCD_SetColor(pObj->aBkColor[1]); _DrawTriangle(&pObj->Widget, r.x1 - ArrowOff, (r.y1 - r.y0) >> 1, ArrowSize, 1); WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &r); /* Draw overlap area (if any ...) */ if (Pos.x1_RightArrow != Pos.x1) { r.x0 = Pos.x1_RightArrow + 1; r.x1 = Pos.x1; LCD_SetColor(pObj->aColor[0]); WIDGET__FillRectEx(&pObj->Widget, &r); } #if (LCD_BITSPERPIXEL == 1) && LCD_BITSPERPIXELF {//SCROLLBAR_POSITIONS LCD_SetBkColor(GUI_BLACK); LCD_SetColor(GUI_WHITE); r = rClient; if(pObj->Widget.State & WIDGET_STATE_VERTICAL) { WIDGET__RotateRect90(&pObj->Widget, &r, &r); } r.x0++; r.x1--; r.y1--; GUI_DrawRect(r.x0,r.y0,r.x1,r.y1); } #endif }
|