当前位置:网站首页>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
:
边栏推荐
猜你喜欢

Strictly abide by the construction period and ensure the quality, this AI data annotation company has done it!

Uniapp wechat login returns user name and Avatar

Potplayer set minimized shortcut keys

中国信通院、清华大学、腾讯安全,云原生安全产学研用强强联合!

Construction of Hisilicon 3559 universal platform: rotation operation on the captured YUV image

Go language sqlx library operation SQLite3 database addition, deletion, modification and query

xshell配置xforward转发火狐浏览器

Array advanced improvement

PotPlayer设置最小化的快捷键

Lambda expression: an article takes you through
随机推荐
PotPlayer设置最小化的快捷键
分布式监控系统zabbix
Typical case of data annotation: how does jinglianwen technology help enterprises build data solutions
密码技术---密钥和SSL/TLS
Jinglianwen technology's low price strategy helps AI enterprises reduce model training costs
antd组件upload上传xlsx文件,并读取文件内容
电路设计者常用的学习网站
Set right click to select vs code to open the file
easyclick,ec权朗网络验证源码
数据标注典型案例,景联文科技如何助力企业搭建数据方案
Mask R-CNN
[leetcode] there are duplicate elements [217]
Higher order operation of bits
[羊城杯2020]easyphp
[leetcode] reverse the word III in the string [557]
情感对话识别与生成简述
Jerry's prototype has no touch, and the reinstallation becomes normal after dismantling [chapter]
WebRTC音视频采集和播放示例及MediaStream媒体流解析
[leetcode] number of palindromes [9]
QT qsplitter splitter