📄 c++ builder 程序设计实用教程 - 6_3_1 绘制直线的子窗体设计 - 张晋 - 17xie.htm
字号:
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">#pragma
resource "*.dfm"<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">TForm_Line
*Form_Line;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">Boolean
Start;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">定义标志变量</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//---------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">__fastcall
TForm_Line::TForm_Line(TComponent* Owner)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN
style="mso-spacerun: yes"> </SPAN>:
TForm(Owner)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'"><o:p> </o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void
__fastcall TForm_Line::FormCreate(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">Start=false;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">初始化标志变量</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'"><o:p> </o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void
__fastcall TForm_Line::Button1Click(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">Start=true;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设置标志变量</SPAN><SPAN
lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'"><o:p> </o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void
__fastcall TForm_Line::FormMouseDown(TObject *Sender, TMouseButton
Button,TShiftState Shift, int X, int Y)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">if
(Start)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN
style="mso-spacerun: yes">
</SPAN>Form_Line->Canvas->LineTo(X,Y);<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN
style="mso-spacerun: yes"> </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 style="FONT-FAMILY: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></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>
<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>Start</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,它的作用是控制程序绘制直线的开始时间,在窗体的初始化过程中通过语句</SPAN><SPAN
lang=EN-US>start:=false;</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设置为</SPAN><SPAN
lang=EN-US>False</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,如果在程序运行的过程中,用户单击按钮“绘制直线”,那么程序就自动的设置变量</SPAN><SPAN
lang=EN-US>Start</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的值为</SPAN><SPAN
lang=EN-US>True</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,然后通过语句</SPAN><SPAN
lang=EN-US>form1.Canvas.LineTo(x,y);</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在窗体上绘制直线。</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><o:p> </o:p></SPAN></P></DIV></DIV></CENTER>
<HR>
<SPAN id=theurl
style="FONT-SIZE: 12px">本页地址:http://www.17xie.com/read.php?pid=5570</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&seq=1'">|<</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=63'">上一页</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=61'">61</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=62'">62</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=63'">63</SPAN>
<SPAN class=page-here
onclick="window.location.href='/read.php?bid=303&seq=64'">64</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=65'">65</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=66'">66</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=67'">67</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=65'">下一页</SPAN>
<SPAN class=page-nor
onclick="window.location.href='/read.php?bid=303&seq=105'">>|</SPAN></NOBR>.</TD>
<TD><INPUT class=input-text
onkeydown='if(window.event.keyCode==13)window.location.href="/read.php?bid=303&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 程序设计实用教程 - 6_3_1 绘制直线的子窗体设计 - 张晋 - 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 程序设计实用教程 - 6_3_1 绘制直线的子窗体设计 - 张晋 - 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 + -