硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2726|回复: 5
收起左侧

[emWin] Progbar进度条显示位图问题

[复制链接]

17

主题

70

回帖

121

积分

初级会员

积分
121
发表于 2018-8-10 11:35:08 | 显示全部楼层 |阅读模式
使用WIDGET_ProgbarCustomSkin.c,在自定义皮肤函数_CustomSkin中显示位图bmIcon_Cloud_SSL_64x64,在这个图标移动到进度条一半后,图标只显示一半。
第二个问题,设置PROGBAR_SetMinMax(hProg, Min, Max);max=150.为什么还是最大显示100%!好像设置了不管用。


  case WIDGET_ITEM_DRAW_BACKGROUND:
    //
    // Receive the area of the PROGBAR widget
    //
    WM_GetClientRectEx(pDrawItemInfo->hWin, &Rect);
    //
    // Adapt the rectangle to be used for rounded rects
    //
    Rect.x0 += RR_ADD;
    Rect.y0 += RR_ADD;
    Rect.x1 -= RR_ADD;
    Rect.y1 -= RR_ADD;
    //
    // Draw a green rounded rect over the complete area, this gets (partially) overwritten by a white one
    //
    GUI_SetColor(GUI_GREEN);
    /*GUI_FillRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, RADIUS);*/
    GUI_DrawBitmap(&bmBACK, Rect.x0, Rect.y0);
    ////
    //// Set a user cliprect
    ////
    //UserRect.x0 = pDrawItemInfo->x0;
    //UserRect.y0 = pDrawItemInfo->y0;
    //UserRect.x1 = pDrawItemInfo->x1;
    //UserRect.y1 = pDrawItemInfo->y1;
    //WM_SetUserClipRect(&UserRect);
    ////
    //// Draw a white rounded rect over the whole PROGBAR area, but the drawing will be visible only in
    //// the area of the cliprect. The size of the cliprect will decrease over time and the white rect
    //// will get smaller.
    ////
    //GUI_SetColor(GUI_WHITE);
    //GUI_FillRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, RADIUS);
    if (((PROGBAR_SKINFLEX_INFO *)pDrawItemInfo->p)->Index == PROGBAR_SKINFLEX_R)
        GUI_DrawBitmap(&bmIcon_Cloud_SSL_64x64, pDrawItemInfo->x0, pDrawItemInfo->y0);
    //GUI_DrawBitmap(&bmIcon_Cloud_SSL_64x64, pDrawItemInfo->x0, pDrawItemInfo->y0);
    ////
    //// Very important, restore the the clipping area
    ////
    //WM_SetUserClipRect(NULL);
    ////
    //// Almost done, just a draw a red frame over the whole area
    ////
    //GUI_SetColor(GUI_RED);
    //GUI_DrawRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, RADIUS);
    return 0;


GUISimulationDebug.exe

913 KB, 下载次数: 115

回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117635
QQ
发表于 2018-8-10 11:57:39 | 显示全部楼层
1、检测下你的裁剪显示区WM_SetUserClipRect参数,是不是没有有效加大。
2、这个是比例关系。
回复

使用道具 举报

17

主题

70

回帖

121

积分

初级会员

积分
121
 楼主| 发表于 2018-8-10 12:11:13 | 显示全部楼层
eric2013 发表于 2018-8-10 11:57
1、检测下你的裁剪显示区WM_SetUserClipRect参数,是不是没有有效加大。
2、这个是比例关系。

1、没有设置裁剪区,我把它屏蔽了
2、那我想显示150%,得手动添加字符串?
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117635
QQ
发表于 2018-8-10 12:17:22 | 显示全部楼层
1314一路向前 发表于 2018-8-10 12:11
1、没有设置裁剪区,我把它屏蔽了
2、那我想显示150%,得手动添加字符串?

1、检测下,估计是你的程序某个数值限制范围,主要就是这个裁剪,检测他的值就行。
2、对,调用Progbar的文本API显示就行。
回复

使用道具 举报

17

主题

70

回帖

121

积分

初级会员

积分
121
 楼主| 发表于 2018-8-10 14:58:12 | 显示全部楼层
eric2013 发表于 2018-8-10 12:17
1、检测下,估计是你的程序某个数值限制范围,主要就是这个裁剪,检测他的值就行。
2、对,调用Progbar ...

PROGBAR_SetTextAlign(hProg, GUI_TA_RIGHT);设置为右对齐,就好了。应该是文字居中的影响,有点坑
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117635
QQ
发表于 2018-8-11 01:15:51 | 显示全部楼层
1314一路向前 发表于 2018-8-10 14:58
PROGBAR_SetTextAlign(hProg, GUI_TA_RIGHT);设置为右对齐,就好了。应该是文字居中的影响,有点坑

谢谢告知最终原因。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-19 13:30 , Processed in 0.040834 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表