当前位置:网站首页>Using cdockablepane to realize floating window in MFC
Using cdockablepane to realize floating window in MFC
2022-06-29 07:37:00 【sam-zy】


Camera.h
#pragma once
#include "afxdialogex.h"
// Camera Dialog box
class Camera : public CDialogEx
{
DECLARE_DYNAMIC(Camera)
public:
Camera(CWnd* pParent = nullptr); // Standard constructors
virtual ~Camera();
// Dialog data
#ifdef AFX_DESIGN_TIME
enum {
IDD = IDD_CAMERA };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedButton1();
};
class CCameraPane : public CDockablePane
{
public:
CCameraPane();
virtual ~CCameraPane();
private:
Camera m_Camera;
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnDestroy();
DECLARE_MESSAGE_MAP()
};
Camera.cpp
// Camera.cpp: Implementation file
//
#include "pch.h"
#include "afxdialogex.h"
#include "Camera.h"
// Camera Dialog box
IMPLEMENT_DYNAMIC(Camera, CDialogEx)
// Dialog data
#ifdef AFX_DESIGN_TIME
enum {
IDD = IDD_CAMERA };
#endif
Camera::Camera(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_CAMERA, pParent)
{
}
Camera::~Camera()
{
}
void Camera::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(Camera, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON1, &Camera::OnBnClickedButton1)
END_MESSAGE_MAP()
// Camera Message handler
void Camera::OnBnClickedButton1()
{
// TODO: Add control notification handler code here
}
CCameraPane::CCameraPane()
{
}
CCameraPane::~CCameraPane()
{
}
void CCameraPane::OnDestroy()
{
CDockablePane::OnDestroy();
m_Camera.DestroyWindow();
}
/// <summary>
/// Subform suspension
/// </summary>
/// <param name="lpCreateStruct"></param>
/// <returns></returns>
int CCameraPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
if (!m_Camera.Create(IDD_CAMERA, this))
{
TRACE0(" Failed to create window /n");
return -1;
}
m_Camera.ShowWindow(SW_SHOW);
return 0;
}
/// <summary>
/// Eliminate the residual shadow of the form
/// </summary>
/// <param name="nType"></param>
/// <param name="cx"></param>
/// <param name="cy"></param>
void CCameraPane::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
if (m_Camera.GetSafeHwnd())
{
CRect rect;
GetClientRect(rect);
m_Camera.MoveWindow(rect);
}
}
BEGIN_MESSAGE_MAP(CCameraPane, CDockablePane)
ON_WM_CREATE()
ON_WM_SIZE()
END_MESSAGE_MAP()
MainFrm.h
CCameraPane m_wndCameraPane;
MainFrm.cpp
// Create test dialog
if (!m_wndCameraPane.Create(_T(" test "), this, CRect(0, 0, 200, 200), TRUE, IDD_CAMERA, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{
TRACE0(" Failed to create window \n");
return FALSE; // Failed to create
}
m_wndCameraPane.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndCameraPane);
边栏推荐
- Select distinct on statement in kingbasees
- Beanpostprocessor and beanfactorypostprocessor
- Swin Transformer理论讲解
- Schnuka: 3D machine vision inspection system 3D vision inspection application industry
- Perceiving healthy life, enabling boundless connection -- contributing to openharmony 3.1 ecological construction
- JMeter can't find its own jar package imported by BeanShell
- 1183: patient queue
- systemd 管理node-exporter
- Alternative writing of if else in a project
- matlab 多普勒效应产生振动信号和处理
猜你喜欢

Markdown skill tree (5): picture

Appium automation test foundation ADB common commands (II)

Vibration signal generation and processing based on MATLAB Doppler effect

SQL 注入绕过(六)

ES中配置ext.dic文件不生效的原因

IMX6DL4.1.15支持EIM总线(上)——实际操作,修改内容。
![[translation] E-Cloud. Large scale CDN using kubeedge](/img/ac/178c078589bb5bc16dbdc8f4ae9525.png)
[translation] E-Cloud. Large scale CDN using kubeedge

机器学习笔记 - 时间序列使用机器学习进行预测

并发幂等性防抖

【翻译】e-Cloud。使用KubeEdge的大规模CDN
随机推荐
Is virtual DOM really the fastest?
mmclassification安装与调试
tf. compat. v1.assign
Schnuka: 3D visual inspection scheme 3D visual inspection application industry
Beanpostprocessor and beanfactorypostprocessor
Relevance - correlation analysis
关于开发web场景下如何解决手机访问web跨域问题
施努卡:3d机器视觉检测系统 3d视觉检测应用行业
Deploy Prometheus server service system management
Markdown 技能树(4):链接
项目中 if else 的代替写法
Do you really understand "binder copy once"?
1031 Hello World for U
服装行业的CRM品牌供应商如何选型?
测试人员需要了解的工具有哪些
ES 查询语法
[software test] interface - Basic test process
Kingbasees coping with transaction rollback caused by too fast growth of table age
Alternative writing of if else in a project
服裝行業的CRM品牌供應商如何選型?