⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 24pointsdlg.h

📁 简单的游戏24点
💻 H
字号:
// 24pointsDlg.h : header file
//

#if !defined(AFX_24POINTSDLG_H__056BA7AC_C1CF_4467_A4FA_72CC7844118F__INCLUDED_)
#define AFX_24POINTSDLG_H__056BA7AC_C1CF_4467_A4FA_72CC7844118F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "PlayCards.h"
/////////////////////////////////////////////////////////////////////////////
// CMy24pointsDlg dialog
class node{
public:
	LOGFONT lgf;
	CPtrArray m_objArray;
	char m_str[3];
	CRect m_rect,rc;
	int m_hit,m_mouse_in,oriIndex;
	CFont font;
	node(){
		m_hit=0;
		memset(m_str,0,3);
		memset(&lgf,0,sizeof(LOGFONT));
		lgf.lfHeight=30; 
		m_mouse_in=0;
		font.CreateFontIndirect(&lgf);
		oriIndex=-1;
	}
	~node()
	{
		font.DeleteObject();
	}
	void Draw(CDC*pDC){
		pDC->SetBkMode(TRANSPARENT);
		CFont*oldFont=pDC->SelectObject(&font);
		CSize size=pDC->GetTextExtent(m_str);
		m_rect.right=m_rect.left+size.cx;
		m_rect.bottom=m_rect.top+size.cy;
		pDC->TextOut(m_rect.left,m_rect.top,m_str);
		pDC->SelectObject(oldFont);
		rc.left=m_rect.right,rc.right=rc.left+2;
		rc.top=m_rect.top,rc.bottom=m_rect.bottom;
		if(m_hit)
		{
			CRect rect=rc;
			rect.top-=5;
			rect.bottom+=5;
			pDC->FillRect(rect,&CBrush(RGB(255,0,0)));
		}
		if(m_mouse_in==1)
		{
			CPen pen;
			pen.CreatePen(PS_SOLID,1,RGB(255,255,255));
			CPen*oldPen=pDC->SelectObject(&pen);
			pDC->MoveTo(m_rect.left,m_rect.bottom);
			pDC->LineTo(m_rect.left,m_rect.top);
			pDC->LineTo(rc.right,rc.top);
			pen.DeleteObject();
			pen.CreatePen(PS_SOLID,1,RGB(0,0,0));
			pDC->SelectObject(&pen);
			pDC->LineTo(rc.right,rc.bottom);
			pDC->LineTo(m_rect.left,m_rect.bottom);
			pDC->SelectObject(oldPen);
		}
		if(m_mouse_in==2)
		{
			CPen pen;
			pen.CreatePen(PS_SOLID,1,RGB(0,0,0));
			CPen*oldPen=pDC->SelectObject(&pen);
			pDC->MoveTo(m_rect.left,m_rect.bottom);
			pDC->LineTo(m_rect.left,m_rect.top);
			pDC->LineTo(rc.right,rc.top);
			pen.DeleteObject();
			pen.CreatePen(PS_SOLID,1,RGB(255,255,255));
			pDC->SelectObject(&pen);
			pDC->LineTo(rc.right,rc.bottom);
			pDC->LineTo(m_rect.left,m_rect.bottom);
			pDC->SelectObject(oldPen);
		}
	}
};

class CMy24pointsDlg : public CDialog
{
	// Construction
public:
	BOOL IsOperator(char ch);
	CRect GetCardsRect(int index);
	CRect GetFormulaRect();
	BOOL Add(node*p,CPoint point,BOOL AtTail=FALSE);
	CMy24pointsDlg(CWnd* pParent = NULL);	// standard constructor
	int m_maxElapse;
	// Dialog Data
	//{{AFX_DATA(CMy24pointsDlg)
	enum { IDD = IDD_MY24POINTS_DIALOG };
	// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA
	
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMy24pointsDlg)
protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL
	
	// Implementation
protected:
	CButton m_ok_button,m_cancel_button,m_submit_button,m_show_button,m_redo_button;
	CStatic m_result;
	void DrawProgress(CStatic*pStatic);
	void DrawFormula(CDC*pDC,CPoint point);
	HICON m_hIcon;
	CPlayCards cards;
	CPoint m_TLP;
	CRect objPreRect,symPreRect,colockRect;
	BOOL m_mouseDown,m_shuffle;
	HCURSOR m_HCursor;
	CRect m_SymbolRect[6],m_strRect[16];
	
	CPtrArray m_objArray;
	node *hitNode;

	CString strGot,m_formula_str;
	int m_index,m_card_index,m_lapse,m_operators;
	static int CursorID[6];
	// Generated message map functions
	//{{AFX_MSG(CMy24pointsDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	virtual void OnOK();
	afx_msg void OnReDo();
	afx_msg void OnSubmit();
	afx_msg void OnShoeExpression();
	virtual void OnCancel();
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	void DrawSyms(CDC*pDC);
public:
//	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_24POINTSDLG_H__056BA7AC_C1CF_4467_A4FA_72CC7844118F__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -