不知道你知不知道字体的本质,你如果想改变字体的显示效果,请去查阅以下几个词的意思和例子,你就会搞定的:
CFont
HFONT
LOGFONT
……
CFont
HFONT
LOGFONT
……
解决方案 »
- 什么是运行时函数,百度也查不到
- Windows下当USB插上时系统都有哪些动作,比如说会有什么消息之类的发生。
- 你们帮我看看奇怪的错误 accept 崩溃 试验了很多机器一样,有时又是10038,有时wshtcpip.dll offset:1691错误
- 如何清空socket缓存区的数据
- 说说学算法的心得!!!!!!!!!!!!!!!
- 哪里有<<windows 2000 内部揭密>>(原书名<<Inside Windows 2000>>)下载?
- 网吧上网突破的一招
- 怎样在我自建的窗口中画点???我怎么也画不上去,郁闷
- unsigned char * 怎么转化为const VARIANT&
- 请Boxsender过来看一下。BitmapToRegion这个函数是怎么写的,我的一个程序正需要它,谢谢了。
- 磁盘文件目录的操作?
- 如何查看控件的源代码?
then
pDC->Select(pTheFont);
Private LF As LOGFONT
……
With LF
.lfUnderline = m_Font.Underline ‘Font Underline
.lfStrikeOut = m_Font.Strikethrough 'Font Strikethrough
.lfItalic = m_Font.Italic 'Font Italic
.lfFaceName = m_Font.Name 'Font Name
.lfCharSet = m_Font.Charset 'Font Charset
.lfWeight = m_Font.Weight 'Font Weight
.lfHeight = m_Font.Size 'Font Size
……
End WithlFont = CreateFontIndirect(LF)
SelectObject .hdc, lFont
TextOut(hdc,480,520,str,strlen(str)),
DeleteObject lFont
CFont font;
font.CreatePointFont(500, "MyFont");
pDC->SelectObject(font);
TCHAR str[60]="欢迎你来到我的天堂!";
strcat(str,zonghe[webfreq]);
HDC hdc = ::GetDC(HWND_DESKTOP);
CreateFont(
10, // logical height of font
10, // logical average character width
0, // angle of escapement
0, // base-line orientation angle
FW_NORMAL, // font weight
TRUE, // italic attribute flag
FALSE, // underline attribute flag
FALSE, // strikeout attribute flag
DEFAULT_CHARSET, // character set identifier
OUT_CHARACTER_PRECIS, // output precision
CLIP_DEFAULT_PRECIS, // clipping precision
DEFAULT_QUALITY, // output quality
FF_DECORATIVE, // pitch and family
str // pointer to typeface name string
);
SelectObject(
hdc, // handle to device context
str // handle to object
);
SetBkMode(hdc,TRANSPARENT);
SetTextColor(hdc,RGB(200,255,70));
TextOut(hdc,480,520,str,strlen(str));
strcat(str,zonghe[webfreq]);
HDC hdc = ::GetDC(HWND_DESKTOP);
CFont font;
font.CreateFont(
24, // logical height of font
24, // logical average character width
0, // angle of escapement
0, // base-line orientation angle
FW_BOLD, // font weight
TRUE, // italic attribute flag
FALSE, // underline attribute flag
FALSE, // strikeout attribute flag
DEFAULT_CHARSET, // character set identifier
OUT_CHARACTER_PRECIS, // output precision
CLIP_DEFAULT_PRECIS, // clipping precision
DEFAULT_QUALITY, // output quality
FF_DECORATIVE, // pitch and family
"Arial" // pointer to typeface name string
);
SelectObject(
hdc, // handle to device context
font // handle to object
);
SetBkMode(hdc,TRANSPARENT);
SetTextColor(hdc,RGB(200,255,70));
TextOut(hdc,480,520,str,strlen(str));
我的程序是用API的,不是用MFC的,编译起来老提示我程序里面的CFont没有定义:
error C2065: 'CFont' : undeclared identifier
遇到这种情况应该怎么办?我是个新手,还没试过解决这样的情况。
strcat(str,zonghe[webfreq]);
HDC hdc = ::GetDC(HWND_DESKTOP);
//CFont font;
HFONT font= ::CreateFont(
24, // logical height of font
24, // logical average character width
0, // angle of escapement
0, // base-line orientation angle
FW_BOLD, // font weight
TRUE, // italic attribute flag
FALSE, // underline attribute flag
FALSE, // strikeout attribute flag
DEFAULT_CHARSET, // character set identifier
OUT_CHARACTER_PRECIS, // output precision
CLIP_DEFAULT_PRECIS, // clipping precision
DEFAULT_QUALITY, // output quality
FF_DECORATIVE, // pitch and family
"Arial" // pointer to typeface name string
);
SelectObject(
hdc, // handle to device context
font // handle to object
);
SetBkMode(hdc,TRANSPARENT);
SetTextColor(hdc,RGB(200,255,70));
TextOut(hdc,480,520,str,strlen(str));还有什么问题吗?