<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>添加 &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/%e6%b7%bb%e5%8a%a0/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Mon, 15 Feb 2021 02:43:15 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] 在Github上添加SSH key</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8github%e4%b8%8a%e6%b7%bb%e5%8a%a0ssh-key/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8github%e4%b8%8a%e6%b7%bb%e5%8a%a0ssh-key/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Tue, 06 Oct 2015 05:06:40 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[综合]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[Permission denied]]></category>
		<category><![CDATA[ssh key]]></category>
		<category><![CDATA[添加]]></category>
		<guid isPermaLink="false">http://www.codelast.com/?p=8559</guid>

					<description><![CDATA[<p>
如果你在Github上有一个项目，为了能让这个项目可以在多台计算机上开发，需要把目标计算机的SSH key添加到你的Github账户中，否则你以SSH方式<span style="color:#0000ff;">git clone</span>时会提示无权限，例如你可以试试：</p>
<blockquote>
<p>
		git clone git@github.com:codelast/raspberry-pi.git</p>
</blockquote>
<p>会输出类似于这样的错误信息：</p>
<blockquote>
<p>
		Permission denied (publickey).</p>
</blockquote>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
所以下一步就要在Github中添加SSH key，让你可以在目标计算机上进行开发以及代码提交。<br />
其实Github上已经有完整的教程了，只不过我记性不好，每次都要去翻Github教程，所以特地写下来。</p>
<p><span style="background-color:#00ff00;">✔</span> 检查SSH key是否已经存在<br />
检查文件&#160;~/.ssh/id_rsa.pub 是否存在，如果存在，就不用生成一个新的SSH key了，直接跳到下面的第3步。<br />
如果该文件存在，但你不想使用它的话，那么就按下面的做法另外生成一个文件也可以(例如 ~/.ssh/id_rsa_github.pub)。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);">✔</span>&#160;生成一个新的SSH key<br />
如果第1步中的SSH key不存在，则需要生成：</p>
<blockquote>
<p>
		ssh-keygen -t rsa -b 4096 -C &#34;your_email@example.com&#34;</p>
</blockquote>
<p>其中，your_email@example.com要修改成你的邮箱地址。<br />
回车后输出如下：</p>
<blockquote>
<div>
		Generating public/private rsa key pair.</div></blockquote>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8github%e4%b8%8a%e6%b7%bb%e5%8a%a0ssh-key/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p>
如果你在Github上有一个项目，为了能让这个项目可以在多台计算机上开发，需要把目标计算机的SSH key添加到你的Github账户中，否则你以SSH方式<span style="color:#0000ff;">git clone</span>时会提示无权限，例如你可以试试：</p>
<blockquote>
<p>
		git clone git@github.com:codelast/raspberry-pi.git</p>
</blockquote>
<p>会输出类似于这样的错误信息：</p>
<blockquote>
<p>
		Permission denied (publickey).</p>
</blockquote>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
所以下一步就要在Github中添加SSH key，让你可以在目标计算机上进行开发以及代码提交。<br />
其实Github上已经有完整的教程了，只不过我记性不好，每次都要去翻Github教程，所以特地写下来。</p>
<p><span style="background-color:#00ff00;"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span> 检查SSH key是否已经存在<br />
检查文件&nbsp;~/.ssh/id_rsa.pub 是否存在，如果存在，就不用生成一个新的SSH key了，直接跳到下面的第3步。<br />
如果该文件存在，但你不想使用它的话，那么就按下面的做法另外生成一个文件也可以(例如 ~/.ssh/id_rsa_github.pub)。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;生成一个新的SSH key<br />
如果第1步中的SSH key不存在，则需要生成：</p>
<blockquote>
<p>
		ssh-keygen -t rsa -b 4096 -C &quot;your_email@example.com&quot;</p>
</blockquote>
<p>其中，your_email@example.com要修改成你的邮箱地址。<br />
回车后输出如下：</p>
<blockquote>
<div>
		Generating public/private rsa key pair.</div>
<div>
		Enter file in which to save the key (/home/xxx/.ssh/id_rsa):</div>
</blockquote>
<p>其中，xxx是你的用户名，直接回车，会将key保存到默认文件中。<br />
接着会输出：</p>
<blockquote>
<div>
		Enter passphrase (empty for no passphrase):&nbsp;</div>
<div>
		Enter same passphrase again:</div>
</blockquote>
<p>这两步是让你输入一个密码，以及确认密码，这个密码在你提交代码到Github时会用到。将这个密码设置成和另一台可以提交代码的计算机上的那个密码一致（要不然在N台计算机上就有N个密码，太麻烦了）。<br />
回车后就提示成功了：</p>
<blockquote>
<div>
		Your identification has been saved in /home/xxx/.ssh/id_rsa.</div>
<div>
		Your public key has been saved in /home/xxx/.ssh/id_rsa.pub.</div>
<div>
		The key fingerprint is:</div>
<div>
		01:0f:f4:3b:...:f0:a2:db your_email@example.com</div>
</blockquote>
<p>到这一步，你会发现&nbsp;~/.ssh/id_rsa.pub 文件已经生成了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;将SSH key添加到ssh-agent<br />
先确认ssh-agent处于启用状态：</p>
<blockquote>
<p>
		eval &quot;$(ssh-agent -s)&quot;</p>
</blockquote>
<p>输出类似于：</p>
<blockquote>
<p>
		Agent pid 32070</p>
</blockquote>
<p>然后将SSH key添加到ssh-agent：</p>
<blockquote>
<p>
		ssh-add ~/.ssh/id_rsa</p>
</blockquote>
<p>这时又会要你输入密码：</p>
<blockquote>
<p>
		Enter passphrase for /home/xxx/.ssh/id_rsa:</p>
</blockquote>
<p>再次输入前面第2步中设置的密码，回车，这一步就算完成了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;将SSH key添加到Github账户中<br />
将SSH key复制到内存：</p>
<blockquote>
<p>
		xclip -sel clip &lt; ~/.ssh/id_rsa.pub</p>
</blockquote>
<p>如果你的程序没有安装过xclip程序的话，需要先用 sudo apt-get install xclip 安装（对Ubuntu来说）。如果你不想装这个程序，直接 cat&nbsp;~/.ssh/id_rsa.pub 并复制出其中的内容也可以。<br />
然后，在Github个人设置的&ldquo;SSH keys&rdquo;界面中，点击&ldquo;Add SSH key&rdquo;，如下图所示：</p>
<p>在 <span style="color:#0000ff;">Title</span> 栏里填一个有意义的名字，用于标识你这个SSH key是用在哪里的，然后在 Key 那一栏里粘贴上刚用 xclip 命令复制出来的SSH key，最后点击&ldquo;Add key&rdquo;即可将此key添加到你的Github账户中了。</p>
<div style="text-align: center;">
	<img decoding="async" alt="Add an SSH key" src="http://www.codelast.com/wp-content/uploads/ckfinder/images/github_add_ssh_key.png" style="width: 504px; height: 457px;" /></div>
<p>
现在再试试本文一开始所说的git clone命令，你应该可以用SSH方式clone你有权限的项目了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;设置每次git远程操作时无需输入密码<br />
在进行git远程操作时，例如git pull，git push等命令，会要求你输入密码，为了免密码操作，可以将密码存储：</p>
<blockquote>
<p>
		git config --global credential.helper store</p>
</blockquote>
<p>此外，在 <span style="color:#0000ff;">~/.ssh/config</span>&nbsp;文件中还要做以下配置：</p>
<blockquote>
<div>
		# GitHub</div>
<div>
		Host github.com</div>
<div>
		HostName github.com</div>
<div>
		<span style="background-color:#ff99ff;">AddKeysToAgent yes</span></div>
<div>
		PreferredAuthentications publickey</div>
<div>
		IdentityFile ~/.ssh/id_rsa</div>
</blockquote>
<div>
	这一段配置，会在你git pull的时候自动读取，它的大概含义就是：对github.com域名，指定使用publickey验证，密钥认证使用的私钥文件是&nbsp;IdentityFile ~/.ssh/id_rsa（如果你像前面说的使用了别的文件名例如 id_rsa_github，那么这里也要做相应的修改）。<br />
	<strong><span style="color:#ee82ee;">注意</span></strong>：标红的那一行，我发现在MacOS上没有的话就无效。</div>
<p>
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8github%e4%b8%8a%e6%b7%bb%e5%8a%a0ssh-key/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>给工具栏上的按钮添加文字（VC）</title>
		<link>https://www.codelast.com/%e7%bb%99%e5%b7%a5%e5%85%b7%e6%a0%8f%e4%b8%8a%e7%9a%84%e6%8c%89%e9%92%ae%e6%b7%bb%e5%8a%a0%e6%96%87%e5%ad%97%ef%bc%88vc%ef%bc%89/</link>
					<comments>https://www.codelast.com/%e7%bb%99%e5%b7%a5%e5%85%b7%e6%a0%8f%e4%b8%8a%e7%9a%84%e6%8c%89%e9%92%ae%e6%b7%bb%e5%8a%a0%e6%96%87%e5%ad%97%ef%bc%88vc%ef%bc%89/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Tue, 14 Sep 2010 02:50:37 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[转帖]]></category>
		<category><![CDATA[VC]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[按钮]]></category>
		<category><![CDATA[文字]]></category>
		<category><![CDATA[添加]]></category>
		<category><![CDATA[给工具栏]]></category>
		<guid isPermaLink="false">http://www.codelast.com/?p=85</guid>

					<description><![CDATA[<p>
	&#160;</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	详见：MSDN里的<span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: 'Courier New'; "><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: medium; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(255, 0, 0); ">CToolBar</span>::<span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 255); ">SetSizes</span></span></span>函数中的示例，摘抄如下：</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	//&#160;这个例子演示了如何将文字添加到工具栏按钮上<br />
	int&#160;CMainFrame::OnCreate(LPCREATESTRUCT&#160;lpCreateStruct)<br />
	{<br />
	if&#160;(CMDIFrameWnd::OnCreate(lpCreateStruct)&#160;==&#160;-1)<br />
	return&#160;-1;<br />
	<span id="more-85"></span>文章来源：http://www.codelast.com/<br />
	//Create&#160;a&#160;toolbar.&#160;Resource&#160;ID&#160;of&#160;the&#160;toolbar&#160;to&#160;be&#160;loaded<br />
	//is&#160;IDR_MAINFRAME.</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	if&#160;(!m_wndToolBar.CreateEx(this,&#160;TBSTYLE_FLAT,&#160;WS_CHILD&#160;&#124;&#160;WS_VISIBLE<br />
	&#124;&#160;CBRS_TOP)&#160;&#124;&#124;&#160;!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))<br />
	{<br />
	TRACE0(&#8220;Failed&#160;to&#160;create&#160;toolbar&#160;&#8221;);<br />
	return&#160;-1;&#160;&#160;//&#160;fail&#160;to&#160;create<br />
	}</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	//&#160;在工具栏按钮上显示文字<br />
	VERIFY(m_wndToolBar.SetButtonText(0,&#8221;New&#8221;));<br />
	VERIFY(m_wndToolBar.SetButtonText(1,&#8221;Open&#8221;));<br />
	VERIFY(m_wndToolBar.SetButtonText(2,&#8221;Save&#8221;));<br />
	VERIFY(m_wndToolBar.SetButtonText(4,&#8221;Cut&#8221;));<br />
	VERIFY(m_wndToolBar.SetButtonText(5,&#8221;Copy&#8221;));<br />
	VERIFY(m_wndToolBar.SetButtonText(6,&#8221;Paste&#8221;));<br />
	VERIFY(m_wndToolBar.SetButtonText(8,&#8221;Print&#8221;));<br />
	VERIFY(m_wndToolBar.SetButtonText(9,&#8221;About&#8221;));</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	CRect&#160;temp;<br />
	m_wndToolBar.GetItemRect(0,&#38;temp);<br />
	m_wndToolBar.SetSizes(CSize(temp.Width(),<br />
	temp.Height()),CSize(16,15));</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	return&#160;0;<br />
	}</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
</p><p>	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;版权声明&#160;<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&#8230; <a href="https://www.codelast.com/%e7%bb%99%e5%b7%a5%e5%85%b7%e6%a0%8f%e4%b8%8a%e7%9a%84%e6%8c%89%e9%92%ae%e6%b7%bb%e5%8a%a0%e6%96%87%e5%ad%97%ef%bc%88vc%ef%bc%89/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>
	&nbsp;</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	详见：MSDN里的<span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: 'Courier New'; "><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: medium; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(255, 0, 0); ">CToolBar</span>::<span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 255); ">SetSizes</span></span></span>函数中的示例，摘抄如下：</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	//&nbsp;这个例子演示了如何将文字添加到工具栏按钮上<br />
	int&nbsp;CMainFrame::OnCreate(LPCREATESTRUCT&nbsp;lpCreateStruct)<br />
	{<br />
	if&nbsp;(CMDIFrameWnd::OnCreate(lpCreateStruct)&nbsp;==&nbsp;-1)<br />
	return&nbsp;-1;<br />
	<span id="more-85"></span>文章来源：http://www.codelast.com/<br />
	//Create&nbsp;a&nbsp;toolbar.&nbsp;Resource&nbsp;ID&nbsp;of&nbsp;the&nbsp;toolbar&nbsp;to&nbsp;be&nbsp;loaded<br />
	//is&nbsp;IDR_MAINFRAME.</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	if&nbsp;(!m_wndToolBar.CreateEx(this,&nbsp;TBSTYLE_FLAT,&nbsp;WS_CHILD&nbsp;|&nbsp;WS_VISIBLE<br />
	|&nbsp;CBRS_TOP)&nbsp;||&nbsp;!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))<br />
	{<br />
	TRACE0(&ldquo;Failed&nbsp;to&nbsp;create&nbsp;toolbar&nbsp;&rdquo;);<br />
	return&nbsp;-1;&nbsp;&nbsp;//&nbsp;fail&nbsp;to&nbsp;create<br />
	}</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	//&nbsp;在工具栏按钮上显示文字<br />
	VERIFY(m_wndToolBar.SetButtonText(0,&rdquo;New&rdquo;));<br />
	VERIFY(m_wndToolBar.SetButtonText(1,&rdquo;Open&rdquo;));<br />
	VERIFY(m_wndToolBar.SetButtonText(2,&rdquo;Save&rdquo;));<br />
	VERIFY(m_wndToolBar.SetButtonText(4,&rdquo;Cut&rdquo;));<br />
	VERIFY(m_wndToolBar.SetButtonText(5,&rdquo;Copy&rdquo;));<br />
	VERIFY(m_wndToolBar.SetButtonText(6,&rdquo;Paste&rdquo;));<br />
	VERIFY(m_wndToolBar.SetButtonText(8,&rdquo;Print&rdquo;));<br />
	VERIFY(m_wndToolBar.SetButtonText(9,&rdquo;About&rdquo;));</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	CRect&nbsp;temp;<br />
	m_wndToolBar.GetItemRect(0,&amp;temp);<br />
	m_wndToolBar.SetSizes(CSize(temp.Width(),<br />
	temp.Height()),CSize(16,15));</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
	return&nbsp;0;<br />
	}</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(77, 77, 77); ">
<p>	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e7%bb%99%e5%b7%a5%e5%85%b7%e6%a0%8f%e4%b8%8a%e7%9a%84%e6%8c%89%e9%92%ae%e6%b7%bb%e5%8a%a0%e6%96%87%e5%ad%97%ef%bc%88vc%ef%bc%89/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
