LayoutFrame-布局框架

LayoutFrame-布局框架

示例代码:

#pragma comment(lib, "XCGUI.lib")
#include "xcgui.h"
class CMyWindowLayout
{
public:
HWINDOW m_hWindow;
HELE m_hLayoutFrame;
CMyWindowLayout()
{
m_hLayoutFrame = NULL;
Init();
}
void Init()
{
m_hWindow = XWnd_Create(0, 0, 600, 600, L"炫彩界面库窗口", NULL, window_style_default);
m_hLayoutFrame = XLayoutFrame_Create(20,50,500,500, m_hWindow);
XSView_SetBorderSize(m_hLayoutFrame, 10, 10, 10, 10);
int top = 10;
HELE hButton = XBtn_Create(10, top, 400, 100, L"导航条", m_hLayoutFrame); top += 110;
hButton = XBtn_Create(10, top, 400, 100, L"图标", m_hLayoutFrame); top += 110;
hButton = XBtn_Create(10, top, 100, 180, L"百度一下,你就知道", m_hLayoutFrame); top += 110;
hButton = XBtn_Create(10, top, 100, 150, L"4", m_hLayoutFrame); top += 110;
XLayoutItem_EnableFloat(hButton, TRUE);
XSView_SetTotalSize(m_hLayoutFrame, 500, 800);
XWnd_RegEventCPP(m_hWindow, WM_SIZE, &CMyWindowLayout::OnWndSize);
AdjustLayout();
XWnd_AdjustLayout(m_hWindow);
XWnd_ShowWindow(m_hWindow, SW_SHOW);
}
void Test()
{
m_hLayoutFrame = XSView_Create(20, 50, 500, 500, m_hWindow);
XSView_SetBorderSize(m_hLayoutFrame, 5, 5, 5, 5);
int top = 10;
HELE hButton = XBtn_Create(10, top, 400, 100, L"1", m_hLayoutFrame); top += 110;
hButton = XBtn_Create(10, top, 400, 100, L"2", m_hLayoutFrame); top += 110;
hButton = XBtn_Create(10, top, 400, 100, L"3", m_hLayoutFrame); top += 110;
hButton = XBtn_Create(10, top, 400, 100, L"4", m_hLayoutFrame); top += 110;
XSView_SetTotalSize(m_hLayoutFrame, 500, 800);
}
void AdjustLayout()
{
RECT rect;
XWnd_GetClientRect(m_hWindow, &rect);
RECT rc = {20,50,00};
rc.right = rect.right - 20;
rc.bottom = rect.bottom - 20;
XEle_SetRect(m_hLayoutFrame, &rc);
}
int OnWndSize(UINT nFlags, SIZE* pSize, BOOL* pbHandled)
{
AdjustLayout();
return 0;
}
};
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
XInitXCGUI(TRUE);
CMyWindowLayout MyWindow;
return 0;
}
@ 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
int WINAPI XEle_SetRect(HELE hEle, RECT *pRect, BOOL bRedraw, int nFlags, UINT nAdjustNo)
元素_置坐标 设置元素坐标.
Definition: EleUI.cpp:3783
BOOL WINAPI XSView_SetTotalSize(HELE hEle, int cx, int cy)
滚动视_置视图大小 设置内容大小.
Definition: ScrollViewUI.cpp:673
HELE WINAPI XSView_Create(int x, int y, int cx, int cy, HXCGUI hParent)
滚动视_创建 创建滚动视图元素.
Definition: ScrollViewUI.cpp:659
void WINAPI XC_ShowLayoutFrame(BOOL bShow)
炫彩_显示布局边界 显示布局对象边界.
Definition: Api.cpp:585
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
HELE WINAPI XLayoutFrame_Create(int x, int y, int cx, int cy, HXCGUI hParent)
@布局框架_创建
Definition: LayoutStack.cpp:173
XWnd_RegEventCPP(hWindow, nEvent, memberFunction)
窗口_注册事件CPP 注册窗口事件,将类成员函数作为事件响应函数.函数省略参数窗口自身句柄hWindow.
BOOL WINAPI XWnd_GetClientRect(HWINDOW hWindow, __out RECT *pRect)
窗口_取客户区坐标 获取窗口客户区坐标;如果是阴影窗口,那么不包含阴影部分.
Definition: WindowUI.cpp:6830
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_AdjustLayout(HWINDOW hWindow)
窗口_调整布局 调整窗口布局, 当窗口显示状态才有效.
Definition: WindowUI.cpp:6718
BOOL WINAPI XWnd_ShowWindow(HWINDOW hWindow, int nCmdShow)
@窗口_显示扩展 显示隐藏及控制窗口最大化还原等
Definition: WindowUI.cpp:6387