📄 combinedlg.cpp
字号:
// CombineDLG.cpp : implementation file
//
#include "stdafx.h"
#include "picviewer.h"
#include "CombineDLG.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCombineDLG dialog
CCombineDLG::CCombineDLG(CWnd* pParent /*=NULL*/)
: CDialog(CCombineDLG::IDD, pParent)
{
//{{AFX_DATA_INIT(CCombineDLG)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
FCImage bk ;
bk.LoadJpeg (MAKEINTRESOURCE (JPG_BACKGROUND), _T("JPG")) ;
m_BkBrush = ::CreatePatternBrush (bk.GetHandle ()) ;
}
CCombineDLG::~CCombineDLG ()
{
::DeleteObject (m_BkBrush) ;
}
void CCombineDLG::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCombineDLG)
DDX_Control(pDX, IDC_CHANNEL_ALPHA, m_cbAlpha);
DDX_Control(pDX, IDC_CHANNEL_BLUE, m_cbBlue);
DDX_Control(pDX, IDC_CHANNEL_GREEN, m_cbGreen);
DDX_Control(pDX, IDC_CHANNEL_RED, m_cbRed);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCombineDLG, CDialog)
//{{AFX_MSG_MAP(CCombineDLG)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCombineDLG message handlers
HBRUSH CCombineDLG::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if ((nCtlColor == CTLCOLOR_DLG) || (nCtlColor == CTLCOLOR_STATIC))
{
pDC->SetBkMode (TRANSPARENT) ;
hbr = m_BkBrush ;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
BOOL CCombineDLG::OnInitDialog()
{
CDialog::OnInitDialog();
POSITION posTemplate = ::AfxGetApp()->GetFirstDocTemplatePosition () ;
while (posTemplate != NULL)
{
CDocTemplate * pTemplate = ::AfxGetApp()->GetNextDocTemplate (posTemplate) ;
POSITION posDoc = pTemplate->GetFirstDocPosition () ;
while (posDoc != NULL)
{
CPicViewerDoc * pDoc = (CPicViewerDoc *)pTemplate->GetNextDoc (posDoc) ;
if (pDoc->m_fPic.IsGrayPalette ())
{
m_cbRed.AddString (pDoc->GetTitle()) ;
m_cbRed.GetCount();
m_cbRed.SetItemData (m_cbRed.GetCount()-1, (DWORD) pDoc) ;
m_cbGreen.AddString (pDoc->GetTitle()) ;
m_cbGreen.SetItemData (m_cbGreen.GetCount()-1, (DWORD) pDoc) ;
m_cbBlue.AddString (pDoc->GetTitle()) ;
m_cbBlue.SetItemData (m_cbBlue.GetCount()-1, (DWORD) pDoc) ;
m_cbAlpha.AddString (pDoc->GetTitle()) ;
m_cbAlpha.SetItemData (m_cbAlpha.GetCount()-1, (DWORD) pDoc) ;
}
}
}
m_cbRed.SetCurSel (0) ;
m_cbGreen.SetCurSel (0) ;
m_cbBlue.SetCurSel (0) ;
m_cbAlpha.SetCurSel (0) ;
return TRUE;
}
void CCombineDLG::OnOK()
{
m_pRed = (m_cbRed.GetCurSel() == 0) ? NULL : &((CPicViewerDoc *)m_cbRed.GetItemData (m_cbRed.GetCurSel()))->m_fPic ;
m_pGreen = (m_cbGreen.GetCurSel() == 0) ? NULL : &((CPicViewerDoc *)m_cbGreen.GetItemData (m_cbGreen.GetCurSel()))->m_fPic ;
m_pBlue = (m_cbBlue.GetCurSel() == 0) ? NULL : &((CPicViewerDoc *)m_cbBlue.GetItemData (m_cbBlue.GetCurSel()))->m_fPic ;
m_pAlpha = (m_cbAlpha.GetCurSel() == 0) ? NULL : &((CPicViewerDoc *)m_cbAlpha.GetItemData (m_cbAlpha.GetCurSel()))->m_fPic ;
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -