ProgressBar-进度条元素

ProgressBar 进度条

进度条元素.

步骤:

  1. XProgBar_Create()创建进度条.
  2. XProgBar_SetPos()设置进度.

示例代码:

#pragma comment(lib, "XCGUI.lib")
#include "xcgui.h"
class CMyWindowProgressBar
{
public:
HWINDOW m_hWindow;
HELE m_hProgressBar;
HELE m_hButtonAdd;
HELE m_hButtonMunus;
CMyWindowProgressBar()
{
Init();
}
void Init()
{
m_hWindow = XWnd_Create(0, 0, 300, 200, L"炫彩界面库窗口",NULL, window_style_default);
m_hProgressBar=XProgBar_Create(20,40,260,20,m_hWindow);
XProgBar_SetRange(m_hProgressBar,10);
XProgBar_SetPos(m_hProgressBar,5);
XProgBar_SetSpaceTwo(m_hProgressBar,10,10);
m_hButtonAdd=XBtn_Create(20,70,50,18,L"+",m_hWindow);
m_hButtonMunus=XBtn_Create(80,70,50,18,L"-",m_hWindow);
XEle_RegEventCPP1(m_hButtonAdd,XE_BNCLICK,&CMyWindowProgressBar::OnBtnClick);
XEle_RegEventCPP1(m_hButtonMunus,XE_BNCLICK,&CMyWindowProgressBar::OnBtnClick);
XEle_RegEventCPP(m_hProgressBar,XE_PROGRESSBAR_CHANGE,&CMyWindowProgressBar::OnProgressBarChange);
XWnd_ShowWindow(m_hWindow,SW_SHOW);
}
int OnBtnClick(HELE hEventEle, BOOL *pbHandled)
{
if(m_hButtonAdd==hEventEle)
{
XProgBar_SetPos(m_hProgressBar,XProgBar_GetPos(m_hProgressBar)+1);
XEle_Redraw(m_hProgressBar);
}else
{
XProgBar_SetPos(m_hProgressBar,XProgBar_GetPos(m_hProgressBar)-1);
XEle_Redraw(m_hProgressBar);
}
return 0;
}
int OnProgressBarChange(int pos,BOOL *pbHandled)
{
*pbHandled=TRUE;
return 0;
}
};
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
XInitXCGUI(TRUE);
CMyWindowProgressBar MyWindow;
return TRUE;
}
#define XE_BNCLICK
按钮点击事件.
Definition: XCGUI.h:939
#define XE_PROGRESSBAR_CHANGE
进度条元素,进度改变事件.
Definition: XCGUI.h:966
@ window_style_default
窗口样式-控制按钮: 居中 图标, 标题, 关闭按钮, 最大化按钮, 最小化按钮
Definition: XCGUI.h:398
HELE WINAPI XBtn_Create(int x, int y, int cx, int cy, const wchar_t *pName, HXCGUI hParent)
按钮_创建 创建按钮元素
Definition: ButtonUI.cpp:1765
void WINAPI XEle_Redraw(HELE hEle, BOOL bImmediate)
元素_重绘 重绘元素.
Definition: EleUI.cpp:4179
void WINAPI XExitXCGUI()
炫彩_退出 退出界面库释放资源. 不可在dllmain()中卸载, 否则会死锁
Definition: App.cpp:572
void WINAPI XRunXCGUI()
炫彩_运行 运行消息循环,当炫彩窗口数量为0时退出.
Definition: App.cpp:564
BOOL WINAPI XInitXCGUI(BOOL bD2D)
炫彩_初始化 初始化界面库.
Definition: App.cpp:557
XEle_RegEventCPP1(hEle, nEvent, memberFunction)
元素_注册事件CPP1 注册元素事件,将类成员函数作为事件响应函数.函数不省略参数.
XEle_RegEventCPP(hEle, nEvent, memberFunction)
元素_注册事件CPP 注册元素事件,将类成员函数作为事件响应函数.函数省略元素自身句柄hEle.
void WINAPI XProgBar_SetPos(HELE hEle, int pos)
进度条_置进度 设置位置点.
Definition: ProgressBarUI.cpp:291
void WINAPI XProgBar_SetRange(HELE hEle, int range)
进度条_置范围 设置范围.
Definition: ProgressBarUI.cpp:250
int WINAPI XProgBar_GetPos(HELE hEle)
进度条_取进度 获取当前位置点.
Definition: ProgressBarUI.cpp:300
HELE WINAPI XProgBar_Create(int x, int y, int cx, int cy, HXCGUI hParent)
进度条_创建 创建进度条元素.
Definition: ProgressBarUI.cpp:217
HWINDOW WINAPI XWnd_Create(int x, int y, int cx, int cy, const wchar_t *pTitle, HWND hWndParent, int XCStyle)
窗口_创建 创建窗口
Definition: WindowUI.cpp:5964
BOOL WINAPI XWnd_ShowWindow(HWINDOW hWindow, int nCmdShow)
@窗口_显示扩展 显示隐藏及控制窗口最大化还原等
Definition: WindowUI.cpp:6387

截图: