访客只能看到部份内容,免费 加入会员 或由脸书 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 版主一样都是电子科的~也都不是资讯相关科系的呢 ^^" 不过您说的没有错~学东西~只要肯用心~肯花时间学习和练习~没有学不会的 ^_^ 况且~也不是说每个电脑相关科系的学生~电脑就一定很强嘛~嘻嘻