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

📄 ropexdlg.cpp

📁 C:Documents and SettingsAdministrator桌面VC++多媒体特效制作百例CHAR04Ropexp1
💻 CPP
字号:
// ropexdlg.cpp : implementation file
//

#include "stdlib.h"
#include "stdafx.h"
#include "ropexp1.h"
#include "ropexdlg.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRopexp1Dlg dialog

CRopexp1Dlg::CRopexp1Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CRopexp1Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CRopexp1Dlg)
		// 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);
}

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

BEGIN_MESSAGE_MAP(CRopexp1Dlg, CDialog)
	//{{AFX_MSG_MAP(CRopexp1Dlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_LBN_SELCHANGE(IDC_ROPLIST, OnSelchangeRoplist)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRopexp1Dlg message handlers

BOOL CRopexp1Dlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	CenterWindow();
	
	//Fill the list box with ROP options.
	CListBox* pLB = (CListBox*) GetDlgItem(IDC_ROPLIST);
	pLB->AddString("SRCCOPY = 0xCC0020");
	pLB->AddString("SRCPAINT = 0xEE0086");
	pLB->AddString("SRCAND = 0x8800C6");
	pLB->AddString("SRCINVERT = 0x660046"); 
	pLB->AddString("SRCERASE = 0x440328");
	pLB->AddString("NOTSRCCOPY = 0x330008");
	pLB->AddString("NOTSRCERASE = 0x1100A6");
	pLB->AddString("MERGECOPY = 0xC000CA");
	pLB->AddString("MERGEPAINT = 0xBB0226");
	pLB->AddString("PATCOPY = 0xF00021");
	pLB->AddString("PATPAINT = 0xFB0A09");
	pLB->AddString("PATINVERT = 0x5A0049");
	pLB->AddString("DSTINVERT = 0x550009");
	pLB->AddString("BLACKNESS = 0x000042");
	pLB->AddString("WHITENESS = 0xFF0062");
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CRopexp1Dlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CRopexp1Dlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CRopexp1Dlg::OnSelchangeRoplist() 
{
	//When the user changes the list box selection.
	CString ROPText;
	CDC* pDC = GetDC();

	//Retrieve the selected text in the list box.
	CListBox* pLB = (CListBox*) GetDlgItem(IDC_ROPLIST);
	pLB->GetText(pLB->GetCurSel(), ROPText);

	//Extract the hexadecimal portion of the text.
	ROPText = ROPText.Mid(ROPText.Find('=') + 1);

	//Convert hexadecimal string to a long integer.
	char *stopstring;
	long rop = strtol(ROPText, &stopstring, 16);

	//We must use the CDialog member function MapDialogRect()
	//to convert the dialog units to logical units. Note that we 
	//only care about the top left corners since icons are always
	//32 pixels on a side.
	CRect rect1(17,11,100,100);
	CRect rect2(75,11,100,100);
	CRect rect3(133,11,200,200);
	MapDialogRect(rect1);
	MapDialogRect(rect2);
	MapDialogRect(rect3);
	
	//Perform the blits. First copy one icon to the destination.
	pDC->BitBlt(rect3.left, rect3.top, 32, 32, pDC,rect1.left, rect1.top, SRCCOPY);

	//Then blit the second using using the selected mode.
	pDC->BitBlt(rect3.left, rect3.top, 32, 32, pDC,rect2.left, rect2.top, rop);
		
}

⌨️ 快捷键说明

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