You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.6 KiB
C++

#include "stdafx.h"
#include "MyPictrueBttom.h"
#include "GlobalDefine.h"
IMPLEMENT_DYNAMIC(CMyPictrueBttom, CMFCButton)
BEGIN_MESSAGE_MAP(CMyPictrueBttom, CMFCButton)
END_MESSAGE_MAP()
CMyPictrueBttom::CMyPictrueBttom()
{
m_CurPicType = _EPicType_1;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_PictrueId1 = 0;
m_PictrueId2 = 0;
m_PictrueId3 = 0;
m_PictrueId4 = 0;
m_font.CreatePointFont(100,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>",NULL);
}
CMyPictrueBttom::~CMyPictrueBttom()
{
}
void CMyPictrueBttom::Refresh()
{
SetFont(&m_font);
}
void CMyPictrueBttom::SetCurPicType(EPicType t)
{
//<2F>ޱ仯
if(m_CurPicType == t)
return;
m_CurPicType = t;
int PictrueId = 0;
switch(t)
{
case _EPicType_1:
PictrueId = m_PictrueId1;
break;
case _EPicType_2:
PictrueId = m_PictrueId2;
break;
case _EPicType_3:
PictrueId = m_PictrueId3;
break;
case _EPicType_4:
PictrueId = m_PictrueId4;
break;
default:
break;
}
if(PictrueId!=0)
{
SetImage(PictrueId);
//ˢ<><CBA2><EFBFBD><EFBFBD>ʾ
Refresh();
}
}
//<2F><><EFBFBD>μ<EFBFBD><CEBC>̲<EFBFBD><CCB2><EFBFBD>
BOOL CMyPictrueBttom::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
char c = pMsg->wParam;
if(c==VK_RETURN || c==VK_ESCAPE)
{
return TRUE;
}
}
return CMFCButton::PreTranslateMessage(pMsg);
}
//<2F><><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>ON/OFF<46>İ<EFBFBD>ť
void CMyPictrueBttom::SetPictrueByBool(bool b)
{
if(b)
{
SetCurPicType(_EPicType_2);
}
else
{
SetCurPicType(_EPicType_1);
}
}