📄 slidmon.cpp
字号:
// SlidMon.cpp: implementation of the CSlidMon class.
//
//////////////////////////////////////////////////////////////////////
#include <assert.h>
#include <math.h>
#include "stdafx.h"
#include "mixer.h"
#include "SlidMon.h"
#include "ColGen.h"
#include "Col.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CSlidMon::~CSlidMon()
{
}
bool CSlidMon::SetSmValue(float f)
{
if(fabs(m_fSmVal-f) > 0.001)
{
m_fSmVal=f;
m_bUpdate=true;
return true;
}
return false;
}
bool CSlidMon::DoUpdate()
{
if(m_bUpdate) {
::InvalidateRect(GetWndHandle(),NULL,m_bClearBack?TRUE:FALSE); //TRUE
m_bUpdate=false;
return true;
}
return false;
}
bool CSlidMon::OnWMPaint(HDC para_dc)
{
assert(m_pcColGen);
RECT r;
// if((::GetUpdateRect(GetWndHandle(),&r,FALSE) == FALSE) && !m_bUpdate) //TRUE
// return false;
m_bUpdate=false;
if(::GetUpdateRect(GetWndHandle(),&r,FALSE) == 0)
return false;
::GetClientRect(GetWndHandle(),&r);
// CWinrr=GetClientRect();
PAINTSTRUCT pntstrc;
::BeginPaint(GetWndHandle(),&pntstrc);
int iOrigHt=r.bottom;
int iNewHt=float(r.bottom)*m_fSmVal;
if(iNewHt > iOrigHt)
iNewHt=iOrigHt;
COLORREF uCol;
// int iPenWd=r.right/4;
uCol=m_pcColGen->GetMon();
{ //this is needed to destroy Pens and Brushes in time
CCol cCol(pntstrc.hdc);
m_bDrawing=true;
cCol.ChangeBrush(uCol);
cCol.ChangePen(PS_SOLID,0,uCol);
Rectangle(pntstrc.hdc,r.left,r.bottom-iNewHt,r.right,r.bottom);
// Rectangle(pntstrc.hdc,GetClientRect().X(),GetClientRect().Y()-iNewHt,
// GetClientRect().X1(),GetClientRect().Y1());
// cCol.ChangePen(pntstrc.hdc,PS_SOLID,0l,false);
// cCol.ChangeBrush(pntstrc.hdc,0l,false);
m_bDrawing=false;
}
::EndPaint(GetWndHandle(),&pntstrc);
return true;
}
void CSlidMon::DeInit()
{
while(m_bDrawing) {
}
m_bUpdate=false;
CAbWin::DeInit();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -