📄 basecontrol.h
字号:
/*******************************************************************************
* Copyright (C) 1980-2008 Xumingxsh
* All rights reserved.
*
* 文件名称: BaseControl.h
* 创建日期: 2008-04-28
* 创 建 人: 徐敏荣
* 说 明: 类BaseControl头文件。
*-------------------------------------------------------------------------------
* 版本 日 期 修改人 修改说明
*-------------------------------------------------------------------------------
* 1.0.0 2008-04-28 徐敏荣 完成初始版本
*******************************************************************************/
#if !defined(AFX_BASECONTROL_H__23E10B1F_1547_40AF_BDD1_26F500A1F985__INCLUDED_)
#define AFX_BASECONTROL_H__23E10B1F_1547_40AF_BDD1_26F500A1F985__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ToolKit.h"
#include "Property.h"
#include "WndX.h"
/**=============================================================================
* 名 称: <BaseControl>
* 说 明: <控件的基类,从配置文件中读取控件属性,并提供控件的基本方法>
* 接 口:
* 调 用:
* 编 程: <徐敏荣>,<2008-04-28>
*=============================================================================*/
class BaseControl : public CWndX
{
private:
static HWND CreateControl(CreateWndStruct &controlStruct);
public:
BaseControl();
virtual ~BaseControl();
public:
/**------------------------------------------------------------------------------------
* 名 称: <SetImg>
* 说 明: <设置控件背景图片的索引值>
* 参 数: <int nIndex>:<索引值>
* 返 回:
*---------------------------------------------------------------------------------------*/
void SetImg(int nIndex);
/**------------------------------------------------------------------------------------
* 名 称: <SetText>
* 说 明: <设置控件的文本>
* 参 数: <CString strText>:<控件文本>
* 返 回:
*---------------------------------------------------------------------------------------*/
void SetText(CString strText);
void SetText(char* chText);
/**------------------------------------------------------------------------------------
* 名 称: <ShowWnd>
* 说 明: <显示或隐藏控件>
* 参 数: <bool isSHOW>:<控件是否显示>
* 返 回:
*---------------------------------------------------------------------------------------*/
void ShowWnd(bool isSHOW);
/**------------------------------------------------------------------------------------
* 名 称: <DrawItem>
* 说 明: <根据属性画出控件>
* 参 数: <WPARAM &wParam>
* <LPARAM &lParam>
* 返 回:
*---------------------------------------------------------------------------------------*/
void DrawItem(WPARAM &wParam, LPARAM &lParam);
/**------------------------------------------------------------------------------------
* 名 称: <CreateControl>
* 说 明: <创建控件>
* 参 数: <char *chValue>:<存储配置信息的字符串>
* <char* key>:<主键>
* <HWND hWnd>:<控件句柄>
* 返 回:
*---------------------------------------------------------------------------------------*/
void CreateControl(char* chValue, char* key, HWND hWnd);
/**------------------------------------------------------------------------------------
* 名 称: <OnMove>
* 说 明: <设置控件位置>
* 参 数:
* 返 回:
*---------------------------------------------------------------------------------------*/
void OnMove();
private:
/**------------------------------------------------------------------------------------
* 名 称: <SetTitleText>
* 说 明: <设置控件的文本>
* 参 数: <HWND hWnd>:<控件句柄>
* <TCHAR* chLabel>:<文本内容>
* <HFONT hFont>:<字体样式>
* <UINT textFormat>:<文本样式>
* <COLORREF rgb>:<字体颜色>
* 返 回:
*---------------------------------------------------------------------------------------*/
void SetTitleText(HWND hWnd, TCHAR* chLabel,
HFONT hFont, UINT textFormat, COLORREF rgb);
/**------------------------------------------------------------------------------------
* 名 称: <DrawBitBmp>
* 说 明: <添加控件的背景图片>
* 参 数: <HWND hwnd>:<控件句柄>
* <CString strFilePath>:<图片路径>
* <int nCount>:<图片索引总数>
* <int nIndex>:<当前索引>
* 返 回:
*---------------------------------------------------------------------------------------*/
void DrawBitBmp(HWND hwnd, CString strFilePath, int nCount, int nIndex);
public:
void OnClick();
bool IsCurContrl(int nID);
void SetEnable(bool isAble);
CString GetText();
int m_nID; // 控件ID
HWND m_parentWnd; // 父控件的句柄
CProperty m_CProperty;
void (*m_ClickEvent)(); // 用户单击响应的操作
};
#endif // !defined(AFX_BASECONTROL_H__23E10B1F_1547_40AF_BDD1_26F500A1F985__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -