当前位置:网站首页>Use the scroll bar of souI when using the real window in souI
Use the scroll bar of souI when using the real window in souI
2022-07-02 23:08:00 【Brick carrying Taoist】
stay UI Reasonable use of real windows in general can make full use of existing controls , And reduce the trouble of rewriting , But in DUI Inner fusion is a problem , Controls with scroll bars generally have their own scroll bars , This situation may require HOOK Drop the current control . The other is that the size of your own window implementation is larger than the size of the view, and you need to display the scroll bar , This article discusses the second case . In this case, use SOUI The way I use the self-contained scroll bar is to add another layer on the outer layer. The real window answers like this clip Effect of sub window . Here we only talk about the key parts without providing source code .
One 、 Close window transparency , A real window cannot be displayed as a child window in a transparent window .
Two 、 Add... When the outer window is created WS_CLIPCHILDREN sign .
3、 ... and 、 Put a in the Zhenzi window scollview in .
Four 、 When creating a real child window, you need to create two layers , Outside for clip The function is always the same as the view size . The following is the method I used to create
HWND CVideoHostWnd::Create(HWND hWndParent, int id)
{
HWND hWnd = SNativeWnd::Create(_T("video_host_wnd"), WS_CHILD | WS_VISIBLE/*| WS_CLIPCHILDREN*/, NULL, 0, 0, 0, 0, hWndParent, NULL);
m_hRealWnd.Create(_T("video_wnd"), WS_CHILD | WS_VISIBLE, NULL, 0, 0, 0, 0, hWnd, NULL);
SetRelWndID(id);
return hWnd;
}
stay IRealWndHandler Interface implemented OnRealWndCreate
CVideoHostWnd* pvideoWnd = new CVideoHostWnd();
pvideoWnd->Create(pRealWnd->GetContainer()->GetHostHwnd(),pRealWnd->GetID());
pRealWnd->SetData(pvideoWnd);
// Returns the window handle after successful creation
return pvideoWnd->m_hWnd;
5、 ... and 、 Adjust the size and position of the two windows at the right time
void CRealWndHelper::Init(CVideoHostWnd* pvideoWnd, SScrollView* pScoroll)
{
m_pvideoWnd = pvideoWnd;
m_pScoroll = pScoroll;
SASSERT(m_pvideoWnd && m_pScoroll);
m_pScoroll->GetEventSet()->subscribeEvent<CRealWndHelper, EventScrollViewOriginChanged>(&CRealWndHelper::OnScrollViewOriginChanged, this);
m_pScoroll->GetEventSet()->subscribeEvent<CRealWndHelper, EventScrollViewSizeChanged>(&CRealWndHelper::OnScrollViewSizeChanged, this);
}
void CRealWndHelper::SetvideoViewSize(CSize szViewSize)
{
SASSERT(m_pvideoWnd && m_pScoroll);
m_pScoroll->SetAttribute(L"viewsize", SStringT().Format(L"%dpx,%dpx", szViewSize.cx, szViewSize.cy), TRUE);
m_pScoroll->RequestRelayout();
}
bool CRealWndHelper::OnScrollViewSizeChanged(EventScrollViewSizeChanged* pEv)
{
m_pvideoWnd->SetRelWndSize(pEv->szNewViewSize);
return true;
}
bool CRealWndHelper::OnScrollViewOriginChanged(EventScrollViewOriginChanged* pEv)
{
m_pvideoWnd->SetRelWndOrg(pEv->ptNewOrigin);
return true;
}
The final effect is as follows :
边栏推荐
- Is 408 not fragrant? The number of universities taking the 408 examination this year has basically not increased!
- 2016. maximum difference between incremental elements
- Mask R-CNN
- 在SOUI里使用真窗口时使用SOUI的滚动条
- The motivation of AES Advanced Encryption Protocol
- Static file display problem
- Jericho's thimble reaction when directly touching the prototype is abnormal [chapter]
- PotPlayer设置最小化的快捷键
- 从底层结构开始学习FPGA----Xilinx ROM IP的定制与测试
- QT qsplitter splitter
猜你喜欢
随机推荐
LeetCode 968. 监控二叉树
分布式监控系统zabbix
Qt QProgressBar详解
Sword finger offer II 099 Sum of minimum paths - double hundred code
Performance optimization - rigorous mode
P1007 single log bridge
SQL进阶语法
Successfully changed Splunk default URL root path
Potplayer set minimized shortcut keys
[hardware] origin of standard resistance value
最小生成树 Minimum Spanning Tree
Jerry's fast touch does not respond [chapter]
The kth largest element in the [leetcode] array [215]
[Solved] Splunk: Cannot get username when all users are selected“
Is 408 not fragrant? The number of universities taking the 408 examination this year has basically not increased!
Editor Caton
详解Promise使用
Configuration clic droit pour choisir d'ouvrir le fichier avec vs Code
Typical case of data annotation: how does jinglianwen technology help enterprises build data solutions
移动端 1px 像素兼容性问题,实现1px 边框