Advertisement
Advertisement
| 04.10.2008 at 04:26AM PDT, ID: 23311228 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: |
// E4gameView.cpp : implementation of the CE4gameView class
//
#include "stdafx.h"
#include "E4game.h"
#include "E4gameDoc.h"
#include "E4gameView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CE4gameView
IMPLEMENT_DYNCREATE(CE4gameView, CView)
BEGIN_MESSAGE_MAP(CE4gameView, CView)
//{{AFX_MSG_MAP(CE4gameView)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CE4gameView construction/destruction
CE4gameView::CE4gameView()
{
// TODO: add construction code here
for (int i=0; i<7; i++) {
for (int j=0; j<7; j++) {
int x=(i*70)+10;
int y=-(j*70)-10;
m_rect[i][j].SetRect(x,y,x +60, y - 60);
m_rect[i][j].NormalizeRect();
}
}
}
CE4gameView::~CE4gameView()
{
}
BOOL CE4gameView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CE4gameView drawing
void CE4gameView::OnDraw(CDC* pDC)
{
CE4gameDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->SetMapMode (MM_LOENGLISH);
//
CRect rect;
//
// TODO: add draw code for native data here
//
CPen pen (PS_SOLID,5,RGB(0,0,255));
CPen* pOldPen = pDC->SelectObject (&pen);
pDC->MoveTo (30,-30);
pDC->LineTo (30,-460);
pDC->LineTo (460,-460); //Big rect
pDC->LineTo (460,-30);
pDC->LineTo (30,-30);
pDC->MoveTo (110,-110);
pDC->LineTo (110,-390);
pDC->LineTo (390,-390); //Middle rect
pDC->LineTo (390,-110);
pDC->LineTo (110,-110);
pDC->MoveTo (180,-180);
pDC->LineTo (180,-320);
pDC->LineTo (320,-320); //Small rect
pDC->LineTo (320,-180);
pDC->LineTo (180,-180);
pDC->MoveTo (30,-250);
pDC->LineTo (180,-250);
pDC->MoveTo (250,-30);
pDC->LineTo (250,-180);
pDC->MoveTo (320,-250);
pDC->LineTo (460,-250);
pDC->MoveTo (250,-320);
pDC->LineTo (250,-460);
pDC->SelectObject (pOldPen);
}
/////////////////////////////////////////////////////////////////////////////
// CE4gameView printing
BOOL CE4gameView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CE4gameView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CE4gameView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CE4gameView diagnostics
#ifdef _DEBUG
void CE4gameView::AssertValid() const
{
CView::AssertValid();
}
void CE4gameView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CE4gameDoc* CE4gameView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CE4gameDoc)));
return (CE4gameDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CE4gameView message handlers
void CE4gameView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//
//
CE4gameDoc*pDoc=GetDocument();
//
CClientDC dc (this);
dc.SetMapMode (MM_LOENGLISH);
dc.DPtoLP (&point);
//
//
BOOL bQuit = FALSE;
for (int i=0; i<7 && !bQuit; i++){
for (int j=0; j<7 && !bQuit; j++){
if (m_rect[i][j].PtInRect (point)){
if(pDoc->GetSquare(i,j) ==0) {
if (pDoc->Isitp1Turn()) {
pDoc->Addpiece1 (i,j);
Drawp1 (&dc, &m_rect[i][j]);
}
else{
pDoc->Addpiece2 (i,j);
Drawp2 (&dc, &m_rect[i][j]);
}
}
bQuit = TRUE;
}
}
}
CView::OnLButtonDown(nFlags, point);
}
void CE4gameView::Drawp1(CDC *pDC, CRect *pRect)
{
CE4gameDoc* pDoc = GetDocument();
//
//make a local copy of the rectangle and shrink it.
//
CRect rect;
rect.CopyRect (pRect);
rect.DeflateRect (1,1);
//
//create a red pen and use it to draw an x.
//
CPen pen (PS_SOLID,4,RGB(255,0,0));
CPen* pOldPen = pDC->SelectObject (&pen);
pDC->MoveTo (rect.left, rect.top);
pDC->LineTo (rect.right, rect.bottom);
pDC->MoveTo (rect.left, rect.bottom);
pDC->LineTo (rect.right, rect.top);
pDC->SelectObject (pOldPen);
}
void CE4gameView::Drawp2(CDC *pDC, CRect *pRect)
{
CE4gameDoc* pDoc = GetDocument();
//
//make a local copy of the rectangle and shrink it
//
CRect rect;
rect.CopyRect (pRect);
rect.DeflateRect (1,1);
//
//Create a blue pen and use it to draw an O.
//
CPen pen (PS_SOLID, 4,RGB (0,255,0));
CPen* pOldPen = pDC->SelectObject (&pen);
pDC->SelectStockObject (NULL_BRUSH);
pDC->Ellipse (rect);
pDC->SelectObject (pOldPen);
int count= pDoc->Getcount();
if (count >=12){
AfxMessageBox ("Move Piece");
pDoc->OnNewDocument();
}
}
|