?? 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 + -