📄 cloudpanel.cpp
字号:
// CloudPanel.cpp : implementation file
//
#include "stdafx.h"
#include "DynamicCloud.h"
#include "CloudPanel.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCloudPanel
CCloudPanel::CCloudPanel()
{
this->m_dDrops = NULL ;
this->m_iDropSize = 0 ;
}
CCloudPanel::~CCloudPanel()
{
if(this->m_dDrops != NULL)
delete[] m_dDrops ;
}
BEGIN_MESSAGE_MAP(CCloudPanel, CStatic)
//{{AFX_MSG_MAP(CCloudPanel)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCloudPanel message handlers
double CCloudPanel::GetProperEX()
{
RECT rect ;
GetWindowRect(&rect) ;
int temp = rect.right - rect.left ;
return temp/2. ;
}
void CCloudPanel::OnPaint()
{
CPaintDC dc(this); // device context for painting
CBrush brush(RGB(255,255,255));
RECT rect;
GetWindowRect(&rect) ;
double h = rect.bottom-rect.top ;
double w = rect.right - rect.left ;
dc.FillRect(CRect(0,0,(int)w,(int)h),&brush);
CPen pen(PS_SOLID,2,RGB(255,0,0));
CPen *pOldPen=dc.SelectObject(&pen);
if(m_dDrops != NULL) {
for(int i = 0 ; i < m_iDropSize ; i ++) {
int x = (int)this->m_dDrops [i][0] ;
double ytemp = ( 1 - this->m_dDrops [i][1]) * (h-2) ;
int y = (int) ytemp ;
if( x >5 && x < w-5 && y >0) {
dc.MoveTo(x,y) ;
dc.LineTo(x,y) ;
}
}
}
dc.SelectObject(pOldPen);
// Do not call CStatic::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -