// frmstng.cpp : implementation file // #include "stdafx.h" #include "demo.h" #include "frmstng.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CFrameSettings dialog CFrameSettings::CFrameSettings(CWnd* pParent /*=NULL*/) : CDialog(CFrameSettings::IDD, pParent) { //{{AFX_DATA_INIT(CFrameSettings) m_nDelay = 0; m_nDisposalMethod = 0; m_nLeft = 0; m_nTop = 0; m_fWaitInput = FALSE; m_fApplyAll = FALSE; m_fTransparent = FALSE; //}}AFX_DATA_INIT m_crTransparent= 0; } void CFrameSettings::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFrameSettings) DDX_Text(pDX, IDC_ANIFRAMEDELAY, m_nDelay); DDX_CBIndex(pDX, IDC_ANIFRAMEDISPOSAL, m_nDisposalMethod); DDX_Text(pDX, IDC_ANIFRAMELEFT, m_nLeft); DDX_Text(pDX, IDC_ANIFRAMETOP, m_nTop); DDX_Check(pDX, IDC_ANIFRAMEINPUT, m_fWaitInput); DDX_Check(pDX, IDC_ANIFRAMEALL, m_fApplyAll); DDX_Check(pDX, IDC_ANIFRAMECOLOR, m_fTransparent); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CFrameSettings, CDialog) //{{AFX_MSG_MAP(CFrameSettings) ON_BN_CLICKED(IDC_ANIFRAMECOLOR, OnAniframecolor) ON_BN_CLICKED(IDC_CHOOSECOLOR, OnChoosecolor) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CFrameSettings message handlers BOOL CFrameSettings::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here DisplayColorValue(); GetDlgItem(IDC_CHOOSECOLOR)->EnableWindow(m_fTransparent); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CFrameSettings::OnAniframecolor() { // TODO: Add your control notification handler code here DisplayColorValue(); UpdateData(TRUE); GetDlgItem(IDC_CHOOSECOLOR)->EnableWindow(m_fTransparent); } void CFrameSettings::OnChoosecolor() { // TODO: Add your control notification handler code here CHOOSECOLOR color; COLORREF CustomColors[16] = { RGB(0, 0, 0), RGB(128, 0, 0), RGB(0, 128, 0), RGB(128, 128, 0), RGB(0, 0, 128), RGB(128, 0, 128), RGB(0, 128, 128), RGB(128, 128, 128), RGB(192, 192, 192), RGB(255, 0, 0), RGB(0, 255, 0), RGB(255, 255, 0), RGB(0, 0, 255), RGB(255, 0, 255), RGB(0, 255, 255), RGB(255, 255, 255), }; memset(&color, 0, sizeof(CHOOSECOLOR)); color.lStructSize = sizeof(CHOOSECOLOR); color.hwndOwner = GetOwner()->m_hWnd; color.rgbResult = m_crTransparent; color.lpCustColors = CustomColors; color.Flags = CC_FULLOPEN | CC_RGBINIT; if( ChooseColor(&color) ) { m_crTransparent = color.rgbResult; DisplayColorValue(); } } void CFrameSettings::DisplayColorValue() { TCHAR szTemp[100]; if (m_fTransparent) wsprintf(szTemp, _T("%08X"), m_crTransparent); else szTemp[0]='\0'; SetDlgItemText(IDC_ANIFRAMECOLORBOX, szTemp); }