skinalter.h
来自「《Visual C++视频技术方案宝典》配套光盘」· C头文件 代码 · 共 105 行
H
105 行
// SkinAlter.h : main header file for the SKINALTER application
//
#if !defined(AFX_SKINALTER_H__DC889815_5131_420F_9F30_6A3EDA8CEBBB__INCLUDED_)
#define AFX_SKINALTER_H__DC889815_5131_420F_9F30_6A3EDA8CEBBB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CSkinAlterApp:
// See SkinAlter.cpp for the implementation of this class
//
class CMemDC : public CDC
{
private:
CBitmap* m_bmp;
CBitmap* m_oldbmp;
CDC* m_pDC;
CRect m_Rect;
public:
CMemDC(CDC* pDC, const CRect& rect) : CDC()
{
CreateCompatibleDC(pDC);
m_bmp = new CBitmap;
m_bmp->CreateCompatibleBitmap(pDC, rect.Width(), rect.Height());
m_oldbmp = SelectObject(m_bmp);
m_pDC = pDC;
m_Rect = rect;
}
~CMemDC()
{
m_pDC->BitBlt(m_Rect.left, m_Rect.top, m_Rect.Width(), m_Rect.Height(),
this, m_Rect.left, m_Rect.top, SRCCOPY);
SelectObject(m_oldbmp);
if (m_bmp != NULL)
delete m_bmp;
}
};
//对话框的组成部分
class CFormPart
{
public:
HBITMAP m_hBitmap; //位图资源
CRect m_Rect; //位图资源位置,该位置是相对于右标题部分的相对位置,只对标题栏按钮起作用
};
class CSkin
{
protected:
UINT m_PartCount; //窗体由几部分组成
//窗体各部分位图资源: 0,1,2分别为标题栏的左\中\右3部分
//3,4,5分别为左,下,右边框,6,7,8,9,10,11为标题栏普通按钮和热点按钮
CFormPart* m_pParts;
public:
//加载位图资源
virtual HBITMAP GetBitmapRes(UINT Index) = 0;
virtual Release()= 0;
virtual CPoint GetButtonPos(UINT Index)=0;
virtual BOOL GetDrawRound()=0;
};
class CSkinAlterApp : public CWinApp
{
public:
CSkin* pSkin; //换肤对象
HINSTANCE m_Instance; //Dll实例句柄
BOOL m_LoadDll; //是否加载Dll
public:
BOOL AlterSkin(LPCTSTR lpFileName);
CSkinAlterApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSkinAlterApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CSkinAlterApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SKINALTER_H__DC889815_5131_420F_9F30_6A3EDA8CEBBB__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?