?? starwarsctrl.cpp
字號:
/****************************************************************/
/* */
/* StarWarsCtrl.cpp */
/* */
/* Implementation of the CStarWarsCtrl.cpp class. */
/* */
/* Programmed by Pablo van der Meer */
/* Copyright Pablo Software Solutions 2002 */
/* http://www.pablovandermeer.nl */
/* */
/* Last updated: 10 july 2002 */
/* */
/****************************************************************/
#include "stdafx.h"
#include "resource.h"
#include "StarWarsCtrl.h"
#include <math.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define getrandom(min,max) ((rand()%(int)(((max)+1)-(min)))+(min));
CStarWarsCtrl::CStarWarsCtrl()
{
// protected bitmaps to restore the memory DC's
m_pOldBitmap = NULL;
m_Font.CreateFont(22, 0, 0, 0, FW_BOLD,
FALSE, FALSE, 0, ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH|FF_SWISS, "Tahoma");
m_nScrollSpeed = 2;
m_nStarsSpeed = 20;
}
CStarWarsCtrl::~CStarWarsCtrl()
{
if (m_pOldBitmap != NULL)
m_MainDC.SelectObject(m_pOldBitmap);
}
BEGIN_MESSAGE_MAP(CStarWarsCtrl, CStatic)
//{{AFX_MSG_MAP(CStarWarsCtrl)
ON_WM_PAINT()
ON_WM_SIZE()
ON_WM_TIMER()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/********************************************************************/
/* */
/* Function name : PreSubclassWindow */
/* Description : Initialize some stuff */
/* */
/********************************************************************/
void CStarWarsCtrl::PreSubclassWindow()
{
CClientDC dc(this);
GetClientRect(m_rectClient);
// initialize stars
for (int i = 0; i < NUM_STARS; i++)
{
m_StarArray[i].x = getrandom(0, 1024);
m_StarArray[i].x -= 512;
m_StarArray[i].y = getrandom(0, 1024);
m_StarArray[i].y -= 512;
m_StarArray[i].z = getrandom(0, 512);
m_StarArray[i].z -= 256;
}
m_TextLines.Add("A long time ago");
m_TextLines.Add("");
m_TextLines.Add("in a galaxy far far away");
m_TextLines.Add("");
m_TextLines.Add("this application was programmed by");
m_TextLines.Add("");
m_TextLines.Add("Pablo van der Meer");
m_TextLines.Add("");
m_TextLines.Add("");
CString strAppName = AfxGetApp()->GetProfileString("Settings", "AppName", "Pablo's FTP Server");
m_TextLines.Add(strAppName);
CString strExeName = AfxGetApp()->m_pszExeName;
strExeName += ".exe";
GetVersionInformation(strExeName);
m_TextLines.Add(GetVersionInformation(strExeName));
m_TextLines.Add("");
m_TextLines.Add("");
m_TextLines.Add("Copyright
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -