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

📄 colordlg.cpp

📁 wince下自定义按钮图片和DLG背景!
💻 CPP
字号:
// ColorDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Color.h"
#include "ColorDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CColorDlg dialog

CColorDlg::CColorDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CColorDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CColorDlg)
		// 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 CColorDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CColorDlg)
	DDX_Control(pDX, IDC_BUTTON1, m_HomeBtn);
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CColorDlg, CDialog)
	//{{AFX_MSG_MAP(CColorDlg)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CColorDlg message handlers

BOOL CColorDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen
	//全屏窗体
	///////////////////////////////////////////////////////////////
	int cx,cy;     
	HDC dc =::GetDC(NULL);     
	cx = GetDeviceCaps(dc,HORZRES) + GetSystemMetrics(SM_CXBORDER);     
	cy = GetDeviceCaps(dc,VERTRES) + GetSystemMetrics(SM_CYBORDER);     
	::ReleaseDC(0,dc);     
    
	//去除标题和边框   
	SetWindowLong(m_hWnd,GWL_STYLE, GetWindowLong(m_hWnd,GWL_STYLE) & (~(WS_CAPTION | WS_BORDER)));     
    
	//   置对话框为最顶端并扩充到整个屏幕   
	::SetWindowPos(m_hWnd,HWND_TOPMOST,-(GetSystemMetrics(SM_CXBORDER)+1),
		-(GetSystemMetrics(SM_CYBORDER)+1), cx+1,cy+1, SWP_NOZORDER);     
    
	//隐藏任务栏
	HWND hTaskBar;
	hTaskBar = ::FindWindow(TEXT("HHTaskBar"), NULL);  //搜寻任务栏句柄 
	::ShowWindow(hTaskBar, SW_HIDE); //隐藏
	///////////////////////////////////////////////////////////////
	
	// TODO: Add extra initialization here
	m_HomeBtn.MoveWindow(20,20,23,23,TRUE);
	m_HomeBtn.LoadBitmaps(IDB_BITMAP1,IDB_BITMAP2);
//	m_BITMAP = (HBITMAP)LoadImage(AfxGetInstanceHandle(),"\003.bmp",IMAGE_BITMAP,823,650,LR_LOADFROMFILE);
	m_bmpBackground.LoadBitmap(IDB_BITMAP3);

	m_Static1.SubclassDlgItem(IDC_STATIC,this);
	m_Static1.SetCaption("清除数:");
//	m_Static1.SetBackColor(RGB(222,223,222));
	return TRUE;  // return TRUE  unless you set the focus to a control
}



void CColorDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRect rect;
	GetClientRect(&rect);
	CDC dcMem; 
	dcMem.CreateCompatibleDC(&dc); 
	BITMAP bitMap;
	m_bmpBackground.GetBitmap(&bitMap);
	CBitmap *pbmpOld=dcMem.SelectObject(&m_bmpBackground);
	dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,bitMap.bmWidth,bitMap.bmHeight,SRCCOPY);	
	// Do not call CDialog::OnPaint() for painting messages
}

BOOL CColorDlg::PreCreateWindow(CREATESTRUCT& cs) 
{
	// TODO: Add your specialized code here and/or call the base class
	cs.x = 300;
	cs.y = 400;
	return CDialog::PreCreateWindow(cs);
}

⌨️ 快捷键说明

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