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

📄 subject_33551.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:33551 发表者:龙人 发表日期:2003-03-21 20:11:14
<br>主题:区域设置
<br>内容:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CRect Rect(100,200,300,440);<BR>怎么设置这个区域的颜色。<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:tjhe 回复日期:2003-03-21 20:20:03
<br>内容:使用CDC的函数FillRect:<BR>void FillRect( LPCRECT lpRect, CBrush* pBrush );<BR>或API函数:<BR>int FillRect(<BR>&nbsp;&nbsp;HDC hDC,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // handle to device context<BR>&nbsp;&nbsp;CONST RECT *lprc,&nbsp;&nbsp;// pointer to structure with rectangle<BR>&nbsp;&nbsp;HBRUSH hbr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // handle to brush<BR>);<BR>进行填充<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:思考者 回复日期:2003-03-22 06:30:59
<br>内容:有多个函数来实现,这个问题的实质是:用当前画刷画矩形区域。可选用:<BR>&nbsp;&nbsp;PatBlt函数 原型为:<BR>BOOL PatBlt(int x,int y,int nWidth,int nHeight,DWORD dwRop);<BR>这个函数的功能可以由函数CDC::FillRect来实现,但PatBlt更加灵活。<BR><BR>参数说明如下:<BR> 前两个参数是:矩形区域的左上角点。接其后的两上参数为:矩形区域的宽度与高度。最后一个参数为:光栅操作码。可以是:<BR>&nbsp;&nbsp; BLAKNESS :&nbsp;&nbsp;每个像素设置成黑色;<BR>  DSTINVERT: 每个像素设置为目标色的反色;<BR>&nbsp;&nbsp; PATCOPY:  每个像素设置为填充颜色<BR>&nbsp;&nbsp; PATINVERT: 每个像素设置为画刷图案颜色与目标颜色的XOP操作结果;<BR>&nbsp;&nbsp;WHITNESS:  像素点设置为白色;<BR><BR>在具体运用时:<BR> 要先创建一支,颜色为你想填充的颜色的画刷。并最后一个参数为PATCOPY;<BR><BR>对于圆的填充与不填充,不填充的圆,是画刷为NULL_BRUSH,时所画的圆。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

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