📄 listdlg.cpp
字号:
// ListDlg.cpp : implementation file
//
#include "stdafx.h"
#include "WinSurge.h"
#include "ListDlg.h"
#include "WinSurgeDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CListDlg dialog
CListDlg::CListDlg(CWnd* pParent /*=NULL*/)
: CDialog(CListDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CListDlg)
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
CBitmap m_pDlgBkBmp;
HBITMAP hbm;
hbm=(HBITMAP)LoadImage(NULL,"face\\WinXP经典\\listdlgbg.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
m_pDlgBkBmp.Attach(hbm);
m_bkBrush.CreatePatternBrush(&m_pDlgBkBmp);
}
void CListDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CListDlg)
DDX_Control(pDX, IDC_DEL, m_del);
DDX_Control(pDX, IDOK, m_ok);
DDX_Control(pDX, IDC_LIST, m_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CListDlg, CDialog)
//{{AFX_MSG_MAP(CListDlg)
ON_WM_CTLCOLOR()
ON_WM_LBUTTONDOWN()
ON_LBN_DBLCLK(IDC_LIST, OnDblclkList)
ON_BN_CLICKED(IDC_DEL, OnDel)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CListDlg message handlers
HBRUSH CListDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
if (nCtlColor!= CTLCOLOR_LISTBOX )
return (HBRUSH)m_bkBrush.GetSafeHandle();
else
return hbr;
}
void CListDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM (point.x , point.y));
CDialog::OnLButtonDown(nFlags, point);
}
BOOL CListDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetWindowText("曲目列表--WinSurge");
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE);
this->m_del.SetBitmap(IDB_DEL);
this->m_ok.SetBitmap(IDB_OK);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CListDlg::OnDblclkList()
{
// TODO: Add your control notification handler code here
CString str;
m_list.GetText(m_list.GetCurSel(),str);
CWinSurgeDlg* sdlg=(CWinSurgeDlg*)GetSafeOwner();
sdlg->index=m_list.GetCurSel();
sdlg->open(sdlg->index);
}
void CListDlg::OnDel()
{
// TODO: Add your control notification handler code here
m_list.DeleteString(m_list.GetCurSel());
}
void CListDlg::ChangeType(CString type)
{
m_bkBrush.DeleteObject();
CBitmap m_pDlgBkBmp;
HBITMAP hbm=(HBITMAP)LoadImage(NULL,"face\\"+type+"\\listdlgbg.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
m_pDlgBkBmp.Attach(hbm);
m_bkBrush.CreatePatternBrush(&m_pDlgBkBmp);
RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE);
m_list.ChangeType(type);
}
void CListDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
DeleteObject(m_bkBrush);
CDialog::OnClose();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -