SVG-绘制

示例代码

//包含炫彩界面库文件
#pragma comment(lib, "XCGUI.lib")
#include "xcgui.h"
HSVG hSvg = NULL;
int CALLBACK OnWndDrawWindow(HWINDOW hWindow, HDRAW hDraw, BOOL* pbHandled)
{
*pbHandled = TRUE;
XWnd_DrawWindow(hWindow, hDraw);
if (hSvg)
{
int left = 20;
int top = 50;
XDraw_DrawSvgEx(hDraw, hSvg, left, top, 100, 100); left += 100;
XDraw_DrawSvgEx(hDraw, hSvg, left, top + (100 - 72) / 2, 72, 72); left += 72;
XDraw_DrawSvgEx(hDraw, hSvg, left, top + (100 - 48) / 2, 48, 48); left += 48;
XDraw_DrawSvgEx(hDraw, hSvg, left, top + (100 - 32) / 2, 32, 32); left += 32;
XDraw_DrawSvgEx(hDraw, hSvg, left, top + (100 - 24) / 2, 24, 24); left += 24;
}
return 0;
}
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
XInitXCGUI(TRUE);
HWINDOW hWindow = XWnd_Create(0, 0, 350, 200, L"炫彩界面库窗口", NULL, window_style_default);
hSvg = XSvg_LoadFile(L"svg\\时间戳.svg");
XWnd_RegEventC1(hWindow, WM_PAINT, &OnWndDrawWindow);
XWnd_ShowWindow(hWindow, SW_SHOW);
XSvg_Release(hSvg);
return TRUE;
}
@ window_style_default
窗口样式-控制按钮: 居中 图标, 标题, 关闭按钮, 最大化按钮, 最小化按钮
Definition: XCGUI.h:398
void WINAPI XDraw_DrawSvgEx(HDRAW hDraw, HSVG hSvg, int x, int y, int nWidth, int nHeight)
@绘制_SVG扩展
Definition: DrawDC.cpp:3482
HSVG WINAPI XSvg_LoadFile(const wchar_t *pFileName)
@SVG_加载从文件 UTF8文件
Definition: Svg.cpp:2345
void WINAPI XSvg_Release(HSVG hSvg)
@SVG_释放引用计数
Definition: Svg.cpp:2643
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
XWnd_RegEventC1(hWindow, nEvent, memberFunction)
窗口_注册事件C1 注册窗口事件, 回调函数不省略参数.
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_DrawWindow(HWINDOW hWindow, HDRAW hDraw)
窗口_绘制 在自绘事件函数中,用户手动调用绘制窗口,以便控制绘制顺序.
Definition: WindowUI.cpp:6123
BOOL WINAPI XWnd_ShowWindow(HWINDOW hWindow, int nCmdShow)
@窗口_显示扩展 显示隐藏及控制窗口最大化还原等
Definition: WindowUI.cpp:6387

程序截图