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

📄 subject_58416.htm

📁 vc
💻 HTM
字号:
<p>
序号:58416 发表者:赵斗斗 发表日期:2003-10-31 19:30:35
<br>主题:memset(&amp;LogFont,0,sizeof(LOGFONT))这个函数是干什么的?
<br>内容:[例]用向导生成一个”hello world”程序,用下面的程序段代替相应的程序段即可(vc6.0)<BR><BR>case WM_PAINT:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;LOGFONT LogFont;<BR><BR>HFONT hHelv,hTmsRmn;<BR><BR>memset(&amp;LogFont,0,sizeof(LOGFONT));<BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>LogFont.lfHeight=25;<BR><BR>LogFont.lfWidth=15;<BR><BR>LogFont.lfUnderline=1;<BR><BR>LogFont.lfItalic=1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR><BR>lstrcpy(LogFont.lfFaceName,&#34;Helv&#34;);<BR><BR>hHelv=CreateFontIndirect(&amp;LogFont);<BR><BR>memset(&amp;LogFont,0,sizeof(LOGFONT));<BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`<BR>LogFont.lfHeight=25;<BR><BR>LogFont.lfWidth=15;<BR><BR>LogFont.lfUnderline=1;<BR><BR>LogFont.lfItalic=1;<BR><BR>lstrcpy(LogFont.lfFaceName,&#34;TmsRmn&#34;);<BR><BR>hTmsRmn=CreateFontIndirect(&amp;LogFont);<BR><BR><BR>hdc = BeginPaint(hWnd, &amp;ps);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR>SelectObject(hdc,hHelv);<BR><BR>TextOut(hdc,20,20,&#34;例子&#34;,5);<BR><BR>SelectObject(hdc,hTmsRmn);<BR><BR>TextOut(hdc,5,100,&#34;Times Roman_Underlined and Itatics&#34;,34);<BR><BR><BR>EndPaint(hWnd, &amp;ps);<BR><BR>break;<BR><BR><BR>还有HFONT和LOGFONT有什么区别?为什么会有逻辑字体这个东西?<BR>CreateFont(.....)和CreateFontIndirect(......)这两个函数生成的字体有区别吗?<BR>什么时候该用哪一个?<BR><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>回复者:无情阁东雪 回复日期:2003-10-31 22:26:14
<br>内容: /* MEMSET.C: This program uses memset to<BR> * set the first four bytes of buffer to &#34;*&#34;.<BR> */<BR><BR>#include &lt;memory.h&gt;<BR>#include &lt;stdio.h&gt;<BR><BR>void main( void )<BR>{<BR>&nbsp;&nbsp; char buffer[] = &#34;This is a test of the memset function&#34;;<BR><BR>&nbsp;&nbsp; printf( &#34;Before: %s\n&#34;, buffer );<BR>&nbsp;&nbsp; memset( buffer, '*', 4 );<BR>&nbsp;&nbsp; printf( &#34;After:&nbsp;&nbsp;%s\n&#34;, buffer );<BR>}<BR><BR>Output<BR><BR>Before: This is a test of the memset function<BR>After:&nbsp;&nbsp;**** is a test of the memset function<BR><BR><BR>其余的查MSDN就知道了!
<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-10-31 22:31:06
<br>内容:你看看msdn
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:esong 回复日期:2003-11-01 17:46:55
<br>内容:一楼的说得很清楚了。
<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 + -