//Block.h
#pragma once
class Block
{
public:
CRect pos;
int num;
public:
Block(void);
~Block(void);
};
//view class
public:
Block currentState[5]; // stores the current state of the blocks
void CpuzzleView::OnDraw(CDC* pDC)
{
CpuzzleDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
//draw the 4 blocks and put text into them
for(int i=0;i<4;i++)
{
pDC->Rectangle(currentState[i].pos);
// i'm getting an error for this line:
pDC->TextOut(currentState[i].pos.CenterPoint(), currentState[i].num);
}
pDC->TextOut(currentState[i].pos.CenterPoint(), currentState[i].num);
エラーは、オーバーロードされた関数CDC :: TextOutW()のインスタンスが引数リストに一致しないことを示しています。ただし、関数のプロトタイプは次のとおりです。
CDC::TextOutW(int x, int y, const CString &str )
私が行ったのは、CenterPoint()によって返されるポイントオブジェクトを直接指定した2つのポイントの代わりに、機能しないかどうかだけです。