📄 chap24.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>范例叁</title>
<link rel="stylesheet" href="../../../include/style.css">
</head>
<body>
<font SIZE="2">
<p><small><a href="../../../index.htm">首页</a> >> <a href="../../program.htm">程序设计</a>
>> <a href="../cbuilder.htm">C++ Builder</a> >> </small>图形程式设计基本观念·范例叁</p>
<p align="left"><!--webbot bot="ImageMap" rectangle=" (40,1) (71, 23) chap25.htm" rectangle=" (4,1) (36, 23) chap23.htm" src="../ch1/NextBack.gif" width="72" height="24" alt="NextBack.gif (743字节)" border="0" startspan --><MAP NAME="FrontPageMap"><AREA SHAPE="RECT" COORDS="40, 1, 71, 23" HREF="chap25.htm"><AREA SHAPE="RECT" COORDS="4, 1, 36, 23" HREF="chap23.htm"></MAP><a href="../../../_vti_bin/shtml.exe/program/C++/ch2/chap24.htm/map"><img ismap usemap="#FrontPageMap" border="0" height="24" alt="NextBack.gif (743字节)" src="../ch1/NextBack.gif" width="72"></a><!--webbot bot="ImageMap" endspan i-checksum="23090" --></p>
</font>
<p><font SIZE="2" color="#FF0000">·范例叁</font></p>
<font SIZE="2">
<p>除了以上两个范例之外,我再为你示范两个同样使用简单的画线函式的绘图范例,不过细节我就不再详述了,另外因为它的关键部份程式很短,为了避免你来回读取档案交互参考的困扰,我还是把它列出来,你可以尝试着修改其中的参数,说不定可以产生更为美观的图形呢!</p>
</font>
<p><font SIZE="2">范例叁的输出</font></p>
<p><font SIZE="2"><img SRC="Image3.gif" WIDTH="458" HEIGHT="344">图03</font></p>
<font SIZE="2">
<p>void __fastcall TForm1::FormPaint(TObject *Sender)</p>
<p>{</p>
<p> double A,x1,y1,x2,y2;</p>
<p> int D=100;</p>
<p> double E;</p>
<p> for (int i=0; i<720; i++)</p>
<p> {</p>
<p> A = i*M_PI/360;</p>
<p> E = D*(1+sin(4*A));</p>
<p> x1 = 320+E*cos(A);</p>
<p> x2 = 320+E*cos(A+M_PI/5);</p>
<p> y1 = 240+E*sin(A);</p>
<p> y2 = 240+E*sin(A+M_PI/5);</p>
<p> Canvas->MoveTo(x1,y1);</p>
<p> Canvas->LineTo(x2,y2);</p>
<p> }</p>
<p>}</p>
<p align="right"><!--webbot bot="ImageMap" rectangle=" (40,1) (71, 23) chap25.htm" rectangle=" (0,0) (32, 22) chap23.htm" src="../ch1/NextBack.gif" width="72" height="24" alt="NextBack.gif (743字节)" border="0" startspan --><MAP NAME="FrontPageMap1"><AREA SHAPE="RECT" COORDS="40, 1, 71, 23" HREF="chap25.htm"><AREA SHAPE="RECT" COORDS="0, 0, 32, 22" HREF="chap23.htm"></MAP><a href="../../../_vti_bin/shtml.exe/program/C++/ch2/chap24.htm/map1"><img ismap usemap="#FrontPageMap1" border="0" height="24" alt="NextBack.gif (743字节)" src="../ch1/NextBack.gif" width="72"></a><!--webbot bot="ImageMap" endspan i-checksum="41592" --></p>
<p><small><a href="../../../index.htm">首页</a> >> <a href="../../program.htm">程序设计</a>
>> <a href="../cbuilder.htm">C++ Builder</a> >> </small>图形程式设计基本观念·范例叁</p>
</font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -