void FillRect(LPCRECT lpRect,CBrush* pBrush );
参数:1.指向一个CRECT结构体或CRect对象的指针
2.指向一个画刷的指针
功能:用pBrush指向的画刷填充lpRect指向的区域
实例应用1:用位图填充矩形区域
CBitmap bitmap;
bitmap.LoadBitmap(位图资源标志符);
CBrush brush(&bitmap);
CClientDC dc( GetParent() );
dc.FillRect( &CRect(pointLT,pointRB),&brush );
实例应用2:颜色画刷填充矩形区域
CBrush brush( RGB(0,0,255) );
CClientDC dc( GetParent() );
dc.FillRect( & CRect(pointLT,pointRB),&brush );
注意:使用 “几何图形函数”如Ellipse/Retangle等时,必须将brush选入dc中才能他们才能被调用
备注:
&
符号可以不要,LPCRECT被重载了一个操作operator LPCRECT( ) const throw( );自动将
CRect对象/CRECT结构体变量转换成LPCRECT类型。