#include <windows.h>
还是不让我使FillSolidRect,还有没有其他方法。

解决方案 »

  1.   

    #include <afxwin.h>
    试试
      

  2.   

    CDC::FillRect
    This method fills a specified rectangle using the specified brush. The method fills the complete rectangle, including the left and top borders, but it does not fill the right and bottom borders.void FillRect(
    LPCRECT lpRect,
    CBrush* pBrush ); 
    Parameters
    lpRect 
    Pointer to a RECT structure that contains the logical coordinates of the rectangle to fill. You can also pass a CRect object for this parameter. 
    pBrush 
    Identifies the brush used to fill the rectangle. 
    Res
    The brush must be created using the CBrush methods CreatePatternBrush, and CreateSolidBrush, or retrieved by the GetStockObject Windows CE function. When filling the specified rectangle, FillRect does not include the right and bottom sides of the rectangle. The GDI fills a rectangle up to, but does not include, the right column and bottom row, regardless of the mapping mode. FillRect compares the values of the top, bottom, left, and right members of the specified rectangle. If bottom is less than or equal to top, or if right is less than or equal to left, the rectangle is not drawn.FillRect is similar to CDC::FillSolidRect; however, FillRect takes a brush and therefore can be used to fill a rectangle with a solid color, a dithered color, hatched brushes, or a pattern. FillSolidRect uses only solid colors, indicated by a COLORREF parameter. FillRect usually is slower than FillSolidRect. Requirements
      Windows CE versions: 1.0 and later
      Header file: Declared in Afxwin.h
      Platform: H/PC Pro, Palm-size PC, Pocket PC
      

  3.   

    Afxwin.h 定义了FillSolidRect
      

  4.   

    CBrush m_Brush(RGB(255,0,0));
    CRect rect(0,0,100,100);
    ***->FillRect(rect,&m_Brush);
      

  5.   

    有没有纯SDK的,CBrush' : undeclared identifier
      

  6.   

    #include <windows.h>
    #include <afxwin.h>
    ...
    LRESULT CALLBACK WndProc( HWND hwnd, UINT message,
     WPARAM wParam, LPARAM lParam ) 
    {
    RECT rect;
    rect.top = 100;
    rect.left  = 100;
    rect.right  = 150;
    rect.bottom  = 150;
    switch( message ) {
    case WM_CREATE:
    FillSolidRect( rect, RGB( 255, 0, 0 ) ); <--
    break;
    case WM_DESTROY:
    PostQuitMessage( 0 );
    break;
    } return DefWindowProc( hwnd, message, wParam, lParam );
    }'FillSolidRect' : undeclared identifier高手帮忙
      

  7.   

    先获取客户区坐标!GetClientRect