SVG-图标

示例代码

//包含炫彩界面库文件
#pragma comment(lib, "XCGUI.lib")
#include "xcgui.h"
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
XInitXCGUI(TRUE);
HWINDOW hWindow = XWnd_Create(0, 0, 340, 320, L"炫彩界面库窗口", NULL, window_style_default);
int left = 30;
int top = 50;
HELE hButton = XBtn_Create(left, top, 120, 30, L"测试SVG图标", hWindow);
HIMAGE hImage = XImage_LoadSvgFile(L"svg\\play.svg");
XSvg_SetSize(XImage_GetSvg(hImage), 24, 24);
XBtn_SetIcon(hButton, hImage);
top += 50;
hButton = XBtn_Create(left, top, 120, 30, L"测试SVG图标", hWindow);
hImage = XImage_LoadSvgFile(L"svg\\时间戳.svg");
XSvg_SetSize(XImage_GetSvg(hImage), 24, 24);
XBtn_SetIcon(hButton, hImage);
top += 50;
hButton = XBtn_Create(left, top, 120, 30, L"测试SVG图标", hWindow);
hImage = XImage_LoadSvgFile(L"svg\\量子统计.svg");
XSvg_SetSize(XImage_GetSvg(hImage), 24, 24);
XBtn_SetIcon(hButton, hImage);
top += 50;
hButton = XBtn_Create(left, top, 120, 30, L"测试SVG图标", hWindow);
hImage = XImage_LoadSvgFile(L"svg\\图标-保存.svg");
XSvg_SetSize(XImage_GetSvg(hImage), 24, 24);
XBtn_SetIcon(hButton, hImage);
top += 50;
hButton = XBtn_Create(left, top, 120, 30, L"测试SVG图标", hWindow);
hImage = XImage_LoadSvgFile(L"svg\\test-border.svg");
XSvg_SetSize(XImage_GetSvg(hImage), 24, 24);
XBtn_SetIcon(hButton, hImage);
//--------------------------
left += 150;
top = 50;
hButton = XBtn_Create(left, top, 100, 100, L"测试SVG图标", hWindow);
hImage = XImage_LoadSvgFile(L"svg\\时间戳.svg");
XSvg_SetSize(XImage_GetSvg(hImage), 100, 100);
XEle_AddBkFill(hButton, element_state_flag_leave, COLORREF_MAKE(200, 200, 200, 255));
XEle_AddBkImage(hButton, element_state_flag_leave, hImage);
top += 110;
hButton = XBtn_Create(left, top, 100, 100, L"测试SVG图标", hWindow);
hImage = XImage_LoadSvgFile(L"svg\\图标-保存.svg");
XSvg_SetSize(XImage_GetSvg(hImage), 100, 100);
XEle_AddBkFill(hButton, element_state_flag_leave, COLORREF_MAKE(200, 200, 200, 255));
XEle_AddBkImage(hButton, element_state_flag_leave, hImage);
XWnd_Show(hWindow, TRUE);
return TRUE;
}
@ window_style_default
窗口样式-控制按钮: 居中 图标, 标题, 关闭按钮, 最大化按钮, 最小化按钮
Definition: XCGUI.h:398
void WINAPI XBtn_SetIcon(HELE hEle, HIMAGE hImage)
按钮_置图标 设置图标.
Definition: ButtonUI.cpp:1962
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_AddBkFill(HELE hEle, int nState, COLORREF color)
元素_添加背景填充 添加背景内容填充.
Definition: EleUI.cpp:4449
void WINAPI XEle_AddBkImage(HELE hEle, int nState, HIMAGE hImage)
元素_添加背景图片 添加背景内容图片.
Definition: EleUI.cpp:4460
HSVG WINAPI XImage_GetSvg(HIMAGE hImage)
@图片_取SVG
Definition: ImageFrame.cpp:1364
HIMAGE WINAPI XImage_LoadSvgFile(const wchar_t *pFileName)
@图片_加载从SVG文件 UTF8文件
Definition: ImageFrame.cpp:1314
void WINAPI XSvg_SetSize(HSVG hSvg, int nWidth, int nHeight)
@SVG_置大小
Definition: Svg.cpp:2422
void WINAPI XExitXCGUI()
炫彩_退出 退出界面库释放资源. 不可在dllmain()中卸载, 否则会死锁
Definition: App.cpp:572
void WINAPI XC_ShowSvgFrame(BOOL bShow)
@炫彩_显示边界 辅助功能
Definition: Api.cpp:592
void WINAPI XRunXCGUI()
炫彩_运行 运行消息循环,当炫彩窗口数量为0时退出.
Definition: App.cpp:564
BOOL WINAPI XInitXCGUI(BOOL bD2D)
炫彩_初始化 初始化界面库.
Definition: App.cpp:557
HWINDOW WINAPI XWnd_Create(int x, int y, int cx, int cy, const wchar_t *pTitle, HWND hWndParent, int XCStyle)
窗口_创建 创建窗口
Definition: WindowUI.cpp:5964
void WINAPI XWnd_Show(HWINDOW hWindow, BOOL bShow)
@窗口_显示 显示隐藏窗口
Definition: WindowUI.cpp:6373

程序截图