📄 photolistdlg.cpp
字号:
// PhotoListDlg.cpp: implementation of the CPhotoListDlg class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PhotoListDlg.h"
#include "PhotoViewerDlg.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPhotoListDlg, CNDialog)
ON_BN_CLICKED(IDC_OPEN, OnOpen)
END_MESSAGE_MAP()
CPhotoListDlg::CPhotoListDlg(CNWnd* pParent, UINT uID)
:CNDialog(pParent, uID)
{
}
CPhotoListDlg::~CPhotoListDlg()
{
}
BOOL CPhotoListDlg::OnInitDialog()
{
CNDialog::OnInitDialog();
// subclassing dialog item
m_btnOpen.SubclassDlgItem(IDC_OPEN, this);
m_btnOpen.SetIcon(IDI_NAVIGATION);
m_lbFileList.SubclassDlgItem(IDC_FILE_LIST, this);
m_lbFileList.SetWindowPos(NULL, 1,1,
SCREEN_WIDTH-2, SCREEN_HEIGHT - PV_BAR_HEIGHT-4, 0);
// searching files and add to list box.
FILE_NAME *pFileName = GetFileList(NGetCurrentDir(), //_T("D:\\NavGps"),
_T("*.bmp | *.jpg | *.tif | *.gif | *.png"));
if(pFileName)
{
TCHAR szFileFullName[MAX_PATH +1];
for(int i=0; i<GetCount(); i++)
{
_tcscpy(szFileFullName, pFileName[i].FilePath);
_tcscat(szFileFullName, pFileName[i].FileName);
m_lbFileList.AddItem(szFileFullName, 0);
}
// select the first one in listbox in default and play it.
m_lbFileList.SetCurSel(0);
//PlayItem(0);
}
ReleaseFileList();
return TRUE;
}
BOOL CPhotoListDlg::OnEraseBkgnd(HDC hdc)
{
RECT rc;
SetRect(&rc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
FillSolidRect(hdc, &rc, MP_BAR_COLOR);
return TRUE;
}
HBRUSH CPhotoListDlg::OnCtlColor(HDC hdc,HWND hwnd, UINT nCtlColor)
{
// if neccessary, call base class to set DC attributes
//CNDialog::OnCtlColor(hdc,hwnd, nCtlColor);
static BOOL s_bInit = FALSE;
static HBRUSH s_hbrMenuBar;
if( !s_bInit )
{
s_hbrMenuBar = CreateSolidBrush(MP_BAR_COLOR);
s_bInit = TRUE;
}
// all buttons and route info static control.
if(nCtlColor == WM_CTLCOLORBTN )
{
return s_hbrMenuBar;
}
return CNDialog::OnCtlColor(hdc,hwnd, nCtlColor);
}
void CPhotoListDlg::OnOpen()
{
CPhotoViewerDlg dlg;
if(m_lbFileList.GetCount() > 0 )
{
dlg.SetFileList(&m_lbFileList);
dlg.DoModal();
}
}
LRESULT CPhotoListDlg::WndProc(HWND hWnd,
UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// handle List box's notify message.
if( uMsg == WM_COMMAND && LOWORD(wParam)== IDC_FILE_LIST)
{
// double click one item.
if( HIWORD(wParam) == LBN_DBLCLK )
{
OnOpen();
}
}
return CNDialog::WndProc(hWnd, uMsg, wParam, lParam);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -