代码如下:
// 获得窗口的客户区设备上下文句柄
CClientDC dc(NULL);
//定义字体属性
LOGFONT lf;
lf.lfHeight = 40;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_HEAVY;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = GB2312_CHARSET;
strcpy(lf.lfFaceName,"幼圆");
//创建字体
CFont font;
font.CreateFontIndirect(&lf);
//更改当前字体
CFont *pOldFont = dc.SelectObject(&font);
//绘制字体
dc.SetBkMode(TRANSPARENT);
//dc.SetTextColor(::GetSysColor(COLOR_3DDKSHADOW));
//dc.TextOut(10,10,"文字");
//dc.SetTextColor(::GetSysColor(COLOR_3DHILIGHT));
//恢复设备上下文的原有设置
dc.SelectObject(pOldFont);
// 获得窗口的客户区设备上下文句柄
CClientDC dc(NULL);
//定义字体属性
LOGFONT lf;
lf.lfHeight = 40;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_HEAVY;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = GB2312_CHARSET;
strcpy(lf.lfFaceName,"幼圆");
//创建字体
CFont font;
font.CreateFontIndirect(&lf);
//更改当前字体
CFont *pOldFont = dc.SelectObject(&font);
//绘制字体
dc.SetBkMode(TRANSPARENT);
//dc.SetTextColor(::GetSysColor(COLOR_3DDKSHADOW));
//dc.TextOut(10,10,"文字");
//dc.SetTextColor(::GetSysColor(COLOR_3DHILIGHT));
//恢复设备上下文的原有设置
dc.SelectObject(pOldFont);
解决方案 »
- 急!我想在当前工程里添加其他工程里的资源及其代码,代码新建了个目录存放,但编译连接时老出现资源CVTRES : fatal error CVT1100: duplicate resource -- type:VERSION
- AX 是什么格式啊?
- int型装换成CString型
- 有一个位图,如何知道它是ddb的,还是dib的 ???
- 现在大家说的vc++技术内幕到底是哪本?
- 哪里有rose的ebook下载,多谢
- 关于COM ATL的问题,请教高手!
- 卡死了,CJ60的刷新问题,我实在没辙了,在线待救!
- 求教!关于Visual assist
- 这小段代码怎么出错???
- 编译的提示,什么意思?LINK : warning LNK4089: all references to "SHELL32.dll" discarded by /OPT:REF
- TextOut的问题?
Invalidate我试过不行的,发送WM_PAINT,也必须有个发送对象才行啊。
ndy_w(carpe diem) 的方法:擦?用底色重写,应该怎么抓它的底色啊?
类似:
dc.FillRect(&rctFill, CBrush::FromHandle((HBRUSH)GetStockObject(BLACK_BRUSH)));
, 如果是的话, 这只要用底色重写了dc.GetBkColor(); 就是得到它的底色
然后用 dc.Rectangle 在相应的位置画一个矩形就将它擦除了当然以上方法只适用于纯色的背景, 如果背景是一个位图, 那就又麻烦了些只能用 BitBlt 将相应位置的位图再拷贝一份
我的代码是在一个自定义消息中实现的,背景就是显示的文字五面的屏幕上所见的东西(位图),可能得用你所说的BitBlt,能不能给个简单的实例
我的代码是在一个自定义消息中实现的,背景就是输出的文字下面的屏幕上所见的东西(位图),可能得用你所说的BitBlt,这个就是所说的“截屏”吧。能不能给个简单的实例
DSTINVERT Inverts the destination bitmap.
MERGECOPY Combines the pattern and the source bitmap using the Boolean AND operator.
MERGEPAINT Combines the inverted source bitmap with the destination bitmap using the Boolean OR operator.
NOTSRCCOPY Copies the inverted source bitmap to the destination.
NOTSRCERASE Inverts the result of combining the destination and source bitmaps using the Boolean OR operator.
PATCOPY Copies the pattern to the destination bitmap.
PATINVERT Combines the destination bitmap with the pattern using the Boolean XOR operator.
PATPAINT Combines the inverted source bitmap with the pattern using the Boolean OR operator. Combines the result of this operation with the destination bitmap using the Boolean OR operator.
SRCAND Combines pixels of the destination and source bitmaps using the Boolean AND operator.
SRCCOPY Copies the source bitmap to the destination bitmap.
SRCERASE Inverts the desination bitmap and combines the result with the source bitmap using the Boolean AND operator.
SRCINVERT Combines pixels of the destination and source bitmaps using the Boolean XOR operator.
SRCPAINT Combines pixels of the destination and source bitmaps using the Boolean OR operator.
WHITENESS Turns all output white.
::InvalidateRect(0, Rect, TRUE); 就行rect 即是你要擦除的区域