ThirdDefine.cpp
上传用户:sunnie
上传日期:2022-07-13
资源大小:4512k
文件大小:3k
- #include "stdafx.h"
- #include "ThirdDefine.h"
- /*
- **
- ** 类的构造函数,创建三个控件变量
- **
- */
- CListCtrlRow::CListCtrlRow()
- {
- m_nRow = 0;
- m_pProgressBar = new CProgressCtrl;
- m_pEdit = new CEdit;
- m_pChkBox = new CButton;
- }
- /*
- **
- ** 类的析构函数,销毁变量
- **
- */
- CListCtrlRow::~CListCtrlRow()
- {
- if (NULL != m_pProgressBar)
- {
- delete m_pProgressBar;
- m_pProgressBar = NULL;
- }
- if (NULL != m_pEdit)
- {
- delete m_pEdit;
- m_pEdit = NULL;
- }
- if (NULL != m_pChkBox)
- {
- delete m_pChkBox;
- m_pChkBox = NULL;
- }
- }
- /*
- **
- ** 新建进度条控件
- **
- */
- BOOL
- CListCtrlRow::CreateProgBar(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
- {
- if (NULL != m_pProgressBar)
- {
- m_pProgressBar->Create(dwStyle, rect, pParentWnd, nID);
- return TRUE;
- }
-
- return FALSE;
- }
- /*
- **
- ** 新建编辑框控件
- **
- */
- BOOL
- CListCtrlRow::CreateEditBox(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
- {
- if (NULL != m_pEdit)
- {
- m_pEdit->Create(dwStyle, rect, pParentWnd, nID);
- return TRUE;
- }
- return FALSE;
- }
- /*
- **
- ** 新建复选框控件
- **
- */
- BOOL
- CListCtrlRow::CreateChkBox(LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
- {
- if (NULL != m_pChkBox)
- {
- m_pChkBox->Create(lpszCaption, dwStyle, rect, pParentWnd, nID);
- return TRUE;
- }
- return FALSE;
- }
- /*
- **
- ** 销毁控件
- **
- */
- BOOL
- CListCtrlRow::DestroyWindow()
- {
- BOOL bRet = FALSE;
- if (IsWindow(m_pProgressBar->m_hWnd))
- {
- m_pProgressBar->DestroyWindow();
- bRet = TRUE;
- }
- if (IsWindow(m_pEdit->m_hWnd))
- {
- m_pEdit->DestroyWindow();
- bRet = TRUE;
- }
- if (IsWindow(m_pChkBox->m_hWnd))
- {
- m_pChkBox->DestroyWindow();
- bRet = TRUE;
- }
- return bRet;
- }
- /*
- **
- ** 获取所在行号
- **
- */
- const int
- CListCtrlRow::GetRow() const
- {
- return m_nRow;
- }
- /*
- **
- ** 设置行号
- **
- */
- void
- CListCtrlRow::SetRow(const int nRow)
- {
- m_nRow = nRow;
- }
- /*
- **
- ** 获取进度条变量指针
- **
- */
- CProgressCtrl*
- CListCtrlRow::GetProgressBar() const
- {
- return m_pProgressBar;
- }
- /*
- **
- ** 设置进度条变量
- **
- */
- void
- CListCtrlRow::SetProgressBar(CProgressCtrl* pProgressBar)
- {
- m_pProgressBar = pProgressBar;
- }
- /*
- **
- ** 获取编辑框变量指针
- **
- */
- CEdit*
- CListCtrlRow::GetEdit() const
- {
- return m_pEdit;
- }
- /*
- **
- ** 设置编辑框变量
- **
- */
- void
- CListCtrlRow::SetEdit(CEdit* pEdit)
- {
- m_pEdit = pEdit;
- }
- /*
- **
- ** 获取复选框变量指针
- **
- */
- CButton*
- CListCtrlRow::GetChkBox() const
- {
- return m_pChkBox;
- }
- /*
- **
- ** 设置复选框变量
- **
- */
- void
- CListCtrlRow::SetChkBox(CButton* pChkBox)
- {
- m_pChkBox = pChkBox;
- }
- /*
- **
- ** 移动进度条控件到新位置, 并且重画(默认)
- **
- */
- BOOL
- CListCtrlRow::MoveProgressBar(LPCRECT lpRect, BOOL bRepaint)
- {
- if (NULL != m_pProgressBar)
- {
- m_pProgressBar->MoveWindow(lpRect, bRepaint);
- return TRUE;
- }
- return FALSE;
- }
- /*
- **
- ** 移动编辑框控件到新位置, 并且重画(默认)
- **
- */
- BOOL
- CListCtrlRow::MoveEditBox(LPCRECT lpRect, BOOL bRepaint)
- {
- if (NULL != m_pEdit)
- {
- m_pEdit->MoveWindow(lpRect, bRepaint);
- return TRUE;
- }
- return FALSE;
- }
- /*
- **
- ** 移动复选框控件到新位置, 并且重画(默认)
- **
- */
- BOOL
- CListCtrlRow::MoveChkBox(LPCRECT lpRect, BOOL bRepaint)
- {
- if (NULL != m_pChkBox)
- {
- m_pChkBox->MoveWindow(lpRect, bRepaint);
- return TRUE;
- }
- return FALSE;
- }