⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testcoollistdlg.cpp

📁 自绘CCombBox组件,具有combo组件的所有功能
💻 CPP
字号:
// TestCoolListDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TestCoolList.h"
#include "TestCoolListDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTestCoolListDlg dialog
 unsigned short * pString0 = _T("15889636421");
 unsigned short * pString1 = _T("15889636422");
 unsigned short * pString2 = _T("15889636423");
 unsigned short * pString3 = _T("15889636424");
 unsigned short * pString4 = _T("15889636425");
 unsigned short * pString5 = _T("15889636426");
 unsigned short * pString6 = _T("15889636427");
 unsigned short * pString7 = _T("15889636428");
 unsigned short * pString8 = _T("15889636429");
 unsigned short * pString9 = _T("15889636430");
 unsigned short * pString10 = _T("15889636431");
 unsigned short * pString11 = _T("15889636432");
 unsigned short * pString12 = _T("15889636433");
 unsigned short * pString13 = _T("15889636434");
 unsigned short * pString14 = _T("15889636435");
 unsigned short * pString15 = _T("15889636436");
CTestCoolListDlg::CTestCoolListDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTestCoolListDlg::IDD, pParent),m_OnceFlag(false)
{
	//{{AFX_DATA_INIT(CTestCoolListDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

	m_pTimeArea = NULL;
	m_ListComboBmp.LoadBitmap(IDB_BITMAP2);
	m_MainBkBmp.LoadBitmap(IDB_BITMAP1);


}

void CTestCoolListDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTestCoolListDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CTestCoolListDlg, CDialog)
	//{{AFX_MSG_MAP(CTestCoolListDlg)
	ON_WM_PAINT()
	ON_WM_LBUTTONDOWN()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestCoolListDlg message handlers

BOOL CTestCoolListDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen



	return TRUE;  // return TRUE  unless you set the focus to a control
}



BOOL CTestCoolListDlg::DestroyWindow() 
{


	
	m_MainBkDC.SelectObject(m_pOldMainBmp);
	m_MainBkDC.DeleteDC();
	m_ListComboBmp.DeleteObject();
	m_MainBkBmp.DeleteObject();

	return CDialog::DestroyWindow();
}

void CTestCoolListDlg::OnPaint() 
{
	CPaintDC dc(this); 

	if(!m_OnceFlag)
	{




	m_MainBkDC.CreateCompatibleDC(&dc);

	m_pOldMainBmp=m_MainBkDC.SelectObject(&m_MainBkBmp);

	m_pTimeArea = new CCoolListCtrl;
	m_pTimeArea->InsertBmp(&m_ListComboBmp);
	m_pTimeArea->InsertText(pString0);
	m_pTimeArea->InsertText(pString1);
	m_pTimeArea->InsertText(pString2);
	m_pTimeArea->InsertText(pString3);
	m_pTimeArea->InsertText(pString4);
	m_pTimeArea->InsertText(pString5);
	m_pTimeArea->InsertText(pString6);
	m_pTimeArea->InsertText(pString7);
	m_pTimeArea->InsertText(pString8);
	m_pTimeArea->InsertText(pString9);
	m_pTimeArea->InsertText(pString10);
	m_pTimeArea->InsertText(pString11);
	m_pTimeArea->InsertText(pString12);
	m_pTimeArea->InsertText(pString13);
	m_pTimeArea->InsertText(pString14);
	m_pTimeArea->InsertText(pString15);


	m_TimeAreaRect.left = 32;
	m_TimeAreaRect.top = 32;
	m_TimeAreaRect.right=256;
	m_TimeAreaRect.bottom = 290;

	m_pTimeArea->Create(_T("TimeArea"), WS_CHILD | WS_VISIBLE,
						m_TimeAreaRect, this,1501);



	m_pTimeArea->Init(&m_MainBkDC,&m_TimeAreaRect,&m_TimeAreaRect);

	m_OnceFlag = !m_OnceFlag;

	}

	CRect rect;
	GetClientRect(&rect);
	dc.BitBlt(0,0,rect.Width(),rect.Height(),&m_MainBkDC,0,0,SRCCOPY);
}

#define WM_FURL_MSG WM_USER + 1231//控件收拢消息
void CTestCoolListDlg::OnLButtonDown(UINT nFlags, CPoint point) 
{
	
	CRect rctChild;
	m_pTimeArea->GetWindowRect(&rctChild);
	this->ScreenToClient(&rctChild);

	if(!rctChild.PtInRect(point))
		::PostMessage(m_pTimeArea->m_hWnd,WM_FURL_MSG,NULL,NULL);

	CDialog::OnLButtonDown(nFlags, point);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -