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

📄 c++ builder 程序设计实用教程 - 2_2 颜色调节组件 - 张晋 - 17xie.htm

📁 已经消失的不易找到的C++ builder网络教程总结
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<P class=a><SPAN lang=EN-US><IMG height=256 
src="C++ Builder 程序设计实用教程 - 2_2 颜色调节组件 - 张晋 - 17xie.files/748e8a0086.jpg" 
width=269 v:shapes="_x0000_i1027"></SPAN></P>
<P class=MsoCaption><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图</SPAN><SPAN 
lang=EN-US>2-7<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序运行结果</SPAN></P>
<P class=MsoNormalIndent><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意在程序运行的过程中,在</SPAN><SPAN 
lang=EN-US>CColorGrid</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">组件上用鼠标左键单击可以选择前景色,用鼠标的右键单击可以选择背景色。</SPAN></P>
<P class=MsoNormalIndent><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序的完整源代码如下所示:</SPAN></P>
<DIV 
style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div">
<P class=a0 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"><SPAN 
style="FONT-FAMILY: 仿宋_GB2312; mso-ascii-font-family: 'Times New Roman'">程序清单</SPAN><SPAN 
lang=EN-US 
style="FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt"><o:p></o:p></SPAN></P></DIV>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US>#include &lt;vcl.h&gt;</SPAN></P>
<P class=a1><SPAN lang=EN-US>#pragma hdrstop</SPAN></P>
<P class=a1><SPAN lang=EN-US>#include &lt;stdlib.h&gt;</SPAN></P>
<P class=a1><SPAN lang=EN-US>#include "Color.h"</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US>#pragma package(smart_init)</SPAN></P>
<P class=a1><SPAN lang=EN-US>#pragma link "CGRID"</SPAN></P>
<P class=a1><SPAN lang=EN-US>#pragma resource "*.dfm"</SPAN></P>
<P class=a1><SPAN lang=EN-US>TForm1 *Form1;</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US>__fastcall TForm1::TForm1(TComponent* 
Owner)</SPAN></P>
<P class=a1><SPAN lang=EN-US><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>: 
TForm(Owner)</SPAN></P>
<P class=a1><SPAN lang=EN-US>{</SPAN></P>
<P class=a1><SPAN lang=EN-US>}</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US>void __fastcall TForm1::Button1Click(TObject 
*Sender)</SPAN></P>
<P class=a1><SPAN lang=EN-US>{</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>Form1-&gt;Memo1-&gt;Font-&gt;Color=Form1-&gt;CColorGrid1-&gt;ForegroundColor;</SPAN></P>
<P class=a1><SPAN lang=EN-US>//</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设置文本框的前景色</SPAN></P>
<P class=a1><SPAN lang=EN-US>}</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//---------------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US>void __fastcall TForm1::Button2Click(TObject 
*Sender)</SPAN></P>
<P class=a1><SPAN lang=EN-US>{</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>Form1-&gt;Memo1-&gt;Color=Form1-&gt;CColorGrid1-&gt;BackgroundColor;</SPAN></P>
<P class=a1><SPAN lang=EN-US>//</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设置文本框的背景色</SPAN></P>
<P class=a1><SPAN lang=EN-US>}</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US>void __fastcall TForm1::CheckBox1Click(TObject 
*Sender)</SPAN></P>
<P class=a1><SPAN lang=EN-US>{</SPAN></P>
<P class=a1><SPAN lang=EN-US>if (Form1-&gt;CheckBox1-&gt;Checked)</SPAN></P>
<P class=a1><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
</SPAN>Form1-&gt;Memo1-&gt;Font-&gt;Color=RGB(random(255),random(255),random(255));</SPAN></P>
<P class=a1><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
</SPAN>//</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN 
lang=EN-US>Memo</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">组件中以随机前景色显示文本</SPAN></P>
<P class=a1><SPAN lang=EN-US>}</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US>void __fastcall TForm1::CheckBox2Click(TObject 
*Sender)</SPAN></P>
<P class=a1><SPAN lang=EN-US>{</SPAN></P>
<P class=a1><SPAN lang=EN-US>if (Form1-&gt;CheckBox2-&gt;Checked)</SPAN></P>
<P class=a1><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
</SPAN>Form1-&gt;Memo1-&gt;Color=RGB(random(255),random(255),random(255));</SPAN></P>
<P class=a1><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
</SPAN>//</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN 
lang=EN-US>Memo</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">组件中显示随机背景色</SPAN></P>
<P class=a1><SPAN lang=EN-US>}</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=a1><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US>void __fastcall TForm1::CColorGrid1Change(TObject 
*Sender)</SPAN></P>
<P class=a1><SPAN lang=EN-US>{</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>Form1-&gt;Memo1-&gt;Font-&gt;Color=Form1-&gt;CColorGrid1-&gt;ForegroundColor;</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>Form1-&gt;Memo1-&gt;Color=Form1-&gt;CColorGrid1-&gt;BackgroundColor;</SPAN></P>
<P class=a1><SPAN lang=EN-US>//</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">随时更改文本框的颜色设置</SPAN></P>
<P class=a1><SPAN lang=EN-US>}</SPAN></P>
<P class=a1><SPAN 
lang=EN-US>//-----------------------------------------------------------------------</SPAN></P>
<P class=MsoNormal><SPAN 
lang=EN-US><o:p>&nbsp;</o:p></SPAN></P></DIV></DIV></CENTER>
<HR>
<SPAN id=theurl 
style="FONT-SIZE: 12px">本页地址:http://www.17xie.com/read.php?pid=5522</SPAN> 
</DIV>
<DIV id=read-title style="BORDER-TOP: white 1px solid">
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: right; PADDING-BOTTOM: 8px; PADDING-TOP: 8px">
<TABLE>
  <TBODY>
  <TR>
    <TD><NOBR><SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=1'">|&lt;</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=14'">上一页</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=12'">12</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=13'">13</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=14'">14</SPAN> 
      <SPAN class=page-here 
      onclick="window.location.href='/read.php?bid=303&amp;seq=15'">15</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=16'">16</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=17'">17</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=18'">18</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=16'">下一页</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=105'">&gt;|</SPAN></NOBR>.</TD>
    <TD><INPUT class=input-text 
      onkeydown='if(window.event.keyCode==13)window.location.href="/read.php?bid=303&amp;seq="+this.value' 
      style="WIDTH: 25px"></TD>
    <TD style="PADDING-TOP: 2px">[共105页]</TD></TR></TBODY></TABLE></DIV></DIV>
<DIV id=read-mpage>
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 8px; PADDING-TOP: 8px; TEXT-ALIGN: center">[关注本页] 
[在本页中加入书签] [收藏本书] [推荐本书] </DIV></DIV><!-- foot -->
<DIV id=xie_bottom><A class=xie1 href="http://www.17xie.com/help/help-wzjs.html" 
target=_blank>关于我们</A> <SPAN class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/index.html" target=_blank>帮助中心</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m6" target=_blank>版权声明</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m7" target=_blank>免责声明</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m8" target=_blank>联系我们</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m9" target=_blank>友情链接</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/bbs/show_bbs.php?fid=130"><FONT 
color=red>提交意见</FONT></A> <BR>Copyright <SPAN 
style="FONT-FAMILY: arial">©</SPAN> 2007 17xie.com 互联网协同写书平台<BR>
<SCRIPT language=javascript 
src="C++ Builder 程序设计实用教程 - 2_2 颜色调节组件 - 张晋 - 17xie.files/1261343.js" 
type=text/javascript></SCRIPT>
<NOSCRIPT><A href="http://www.51.la/?1261343" target=_blank><IMG 
style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none" 
alt=我要啦免费统计 
src="C++ Builder 程序设计实用教程 - 2_2 颜色调节组件 - 张晋 - 17xie.files/go.htm"></A></NOSCRIPT> 
</DIV></DIV>
<SCRIPT>			setInterval("ajax_sr('/live.php','')",600000);			function chcolor(sz)			{				$('read-conts').style.backgroundColor = sz;			}						function clcp()			{				var rng = document.body.createTextRange();		        rng.moveToElementText(document.getElementById("theurl"));		        rng.execCommand("Copy");			}			document.body.onkeydown = clcp;			document.body.onmouseout = clcp;			document.body.onclick = clcp;					</SCRIPT>
</BODY></HTML>

⌨️ 快捷键说明

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