訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容
#include <math.h> int sides=5; double pi=3.141592654; double angle; int NewX,NewY; int CenterX=200; int CenterY=200; int LineLength=100; double StartAlgle=-pi/2; Canvas->MoveTo(CenterX,CenterY); for(int i=0;i<=sides;i++) { angle=((360/sides*i)*(pi/180))+StartAlgle; NewX=LineLength*cos(angle)+CenterX; NewY=LineLength*sin(angle)+CenterY; Canvas->LineTo(NewX,NewY); }
#include <math.h>int sides=5;double pi=3.141592654;double angle;int NewX,NewY;int CenterX=200;int CenterY=200;int LineLength=100;double StartAlgle=-pi/2;Canvas->MoveTo(CenterX,CenterY);for(int i=0;i<=sides;i++){ angle=(2*pi/sides*i)+StartAlgle; NewX=LineLength*cos(angle)+CenterX; NewY=LineLength*sin(angle)+CenterY; Canvas->LineTo(NewX,NewY);}
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::FormPaint(TObject *Sender) { Canvas->Ellipse(30,30,300,300); //畫三角形// Canvas->MoveTo(37,126); Canvas->LineTo(165,30); Canvas->MoveTo(293,126); Canvas->LineTo(165,30); Canvas->MoveTo(37,126); Canvas->LineTo(89,276); Canvas->LineTo(240,276); Canvas->LineTo(293,126); //五邊// Canvas->MoveTo(165,165); Canvas->LineTo(293,126); Canvas->MoveTo(165,165); Canvas->LineTo(37,126); Canvas->MoveTo(165,165); Canvas->LineTo(89,276); Canvas->MoveTo(165,165); Canvas->LineTo(165,30); Canvas->MoveTo(165,165); Canvas->LineTo(240,276); } //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { } //---------------------------------------------------------------------------
下面是引用夷希微於2005-06-13 19:32發表的 :嘻嘻~~小妹下班後才發現~~原來我脫褲子放X了 ^^" 改成以上藍色的字就行了~少轉換一次 ^^" ===================================我相信您不貼程式碼的原因應該是擔心被看笑話對吧 :P ^_^ .......
深深思念一個人的時候,我們不知不覺的地活在世界的中心...
下面是引用夷希微於2005-06-13 20:39發表的 :我的天啊~這種畫法~小妹我快昏倒了 ^^" 大大您還真是『腳踏實地』,一步一腳印的畫啊 ^^" 小妹我和 codeboy 版主一樣都是電子科的~也都不是資訊相關科系的呢 ^^" 不過您說的沒有錯~學東西~只要肯用心~肯花時間學習和練習~沒有學不會的 ^_^ 況且~也不是說每個電腦相關科系的學生~電腦就一定很強嘛~嘻嘻