Duilib的圆环形 进度条 实现(网易云信版本)

摘要:
virtualvoidPaintStatusImage(IRenderContext*pRender)覆盖;virtualvoidClearImageCache()重写;/***@Brief当循环进度条*@param[in]bCircular设置为true时,它被设置为循环滚动条/***@Brief设置进度条的背景色*@param[in]strColor要设置的背景色字符串;

/** @file CircleProgress.h
* @brief 圆环型进度条控件,圆环中间可以有文本(如85%)
* @copyright (c) 2019-2022, NetEase Inc. All rights reserved
* @author Xuhuajie
* @date 2019/8/14
*/

#ifndef UI_CONTROL_CIRCLEPROGRESS_H_
#define UI_CONTROL_CIRCLEPROGRESS_H_

#pragma once

namespace ui
{

class UILIB_API CircleProgress : public Progress
{
public:
CircleProgress();

/// 重写父类方法,提供个性化功能,请参考父类声明
virtual void SetAttribute(const std::wstring& strName, const std::wstring& strValue) override;
virtual void PaintStatusImage(IRenderContext* pRender) override;
virtual void ClearImageCache() override;

/**
* @brief 设置圆形进度条
* @param[in] bCircular 为 true 时设置为圆形滚动条,false 时设置为父级滚动条,默认为 true
* @return 无
*/
void SetCircular(bool bCircular = true);
/**
* @brief 设置递增方向
* @param[in] bClockwise 为 true 时设置为顺时针,false 时设置为逆时针,默认为 true
* @return 无
*/
void SetClockwiseRotation(bool bClockwise = true);
/**
* @brief 设置圆环宽度
* @param[in] nCircleWidth 宽度数值
* @return 无
*/
void SetCircleWidth(int nCircleWidth);
/**
* @brief 设置进度条背景颜色
* @param[in] strColor要设置的背景颜色字符串,该字符串必须在 global.xml 中存在
* @return 无
*/
void SetBackgroudColor(const std::wstring& strColor);
/**
* @brief 设置进度条前景颜色
* @param[in] strColor要设置的前景颜色字符串,该字符串必须在 global.xml 中存在
* @return 无
*/
void SetForegroudColor(const std::wstring& strColor);
/**
* @brief 设置进度条前景渐变颜色,与ForegroudColor同时使用,可以不设置,则无渐变效果
* @param[in] strColor要设置的前景渐变颜色字符串,该字符串必须在 global.xml 中存在
* @return 无
*/
void SetCircleGradientColor(const std::wstring& strColor);
/**
* @brief 设置进度指示移动图标
* @param[in] sIndicatorImage要设置的图片
* @return 无
*/
void SetIndicator(const std::wstring& sIndicatorImage);

protected:
bool m_bCircular;
bool m_bClockwise;
int m_nCircleWidth;
DWORD m_dwBackgroundColor;
DWORD m_dwForegroundColor;
DWORD m_dwGradientColor;
//Image m_IndicatorImage; //使用image对象,无法满足需求,需要设置矩阵变换
Gdiplus::Image* m_pIndicator; //此类目前维护资源管理
std::wstring m_sIndicatorImage;

};

} // namespace ui

#endif // UI_CONTROL_CIRCLEPROGRESS_H_

/** @file CircleProgress.cpp
* @brief 圆环型滚动条控件,圆环中间可以有文本(如85%)
* @copyright (c) 2019-2022, NetEase Inc. All rights reserved
* @author Xuhuajie
* @date 2019/8/14
*/

#include "stdafx.h"
#include "CircleProgress.h"
#include "shlwapi.h"

namespace ui
{
CircleProgress::CircleProgress() :
m_bCircular(true),
m_bClockwise(true),
m_nCircleWidth(1),
m_dwBackgroundColor(0),
m_dwForegroundColor(0),
m_dwGradientColor(0),
m_pIndicator(nullptr)
{

}

void CircleProgress::SetAttribute(const std::wstring& srName, const std::wstring& strValue)
{
if (srName == _T("circular")) SetCircular(strValue == _T("true"));
else if (srName == _T("circlewidth")) SetCircleWidth(_ttoi(strValue.c_str()));
else if (srName == _T("indicator")) SetIndicator(strValue);
else if (srName == _T("clockwise")) SetClockwiseRotation(strValue == _T("true"));
else if (srName == _T("bgcolor")) {
LPCTSTR pValue = strValue.c_str();
while (*pValue > _T('

免责声明:内容来源于网络,仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇将日期转换为指定的格式:比如转换成 年月日时分秒 这种格式:yyyy-MM-dd hh:mm:ss 或者 yyyy-MM-dd。总结下。apache转发规则 + nginx location 正则匹配经典案例下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

phpredis中incr以及decr等自增命令出现的问题

在做项目中使用redis的incr以及hincrby自增时,出现自增失败,set之后的数据,无法自增,当redis中不存在该key时,直接用incr是成功的。查找了原因,是因为phpredis初始化的时候,设置了php序列化,即: $redis->setOption( Redis::OPT_SERIALIZER, Redis::SERIALIZER_...

vscode+vue不得不用的插件和不得不添加的配置

先吐槽一下:第一次用vscode,真是心酸,要啥没啥,代码基本错误检测没有也就算了,Html标签自动补全也没有(当然,其实是有的,只是需要用户自己配置),这些都不能在安装或者初始化的时候一起装了吗,还非得要一个个百度然后找插件,心酸。。。 吐槽归吐槽,会用谷歌百度就是大佬。 文件自动保存设置 vscode的强大之一便是自动编译,无需刷新页面,但自动编译是需...

EasyUI 页面分页

DAO package com.hanqi.dao; import java.util.ArrayList; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction...

unittest自定义封装与应用

和大家分享一个自己二次封装uniitest的方法,大家可以在评论区多多指教,一起分享学习; 一、unittest基类封装 import osimport unittestfrom common.log_print import Logfrom common.get_config import getconfigfrom common.base_page_i...

Fiddler 502问题

使用Fiddler的时候遇到下面这个问题:在地址栏想打开个一般处理程序,出现连接本机失败的提示,如下图: 而这在我没打开Fiddler的时候是显示正常的。 查看Fiddler,在嗅探 -> 第二个Raw的报文最下面提示: [Fiddler] Connection to localhost failed.<BR>Exception Tex...

探索Oracle之数据库升级八 12c Downgrade 11gR2

探索Oracle之数据库升级八12c Downgrade 11gR2 前言:        我们前面已经完毕了11gR2 upgrade to 12c 的升级,整个过程还是比較顺利的,尽管和曾经版本号升级有些不太一样,可是整个难度不是太大。可是因为太多的特性不同,大大的加长了升级的时间。        可是对于Oracle 12c降回到之前版本号。会有...