文件名称:基本画线实现算法
介绍说明--下载内容均来自于网络,请自行研究使用
新建一个C++Builder项目 设置Form1的font为“宋体,小五” 在Form1中添加一个TRadioGroup组件rgDrawWhat供选择画什么图形;添加一个Tbutton组件colorBtn和一个TcolorDialog组件ColorDialog1;添加一个TImage组件Image1。 3、 将当前项目保存在自己实验文件夹的exp1子文件夹中(以防错误操作而前功尽弃)。 编写colorBtn的OnClick事件,激活ColorDialog1,并获取所选择的颜色: if (ColorDialog1->Execute()) Image1->Canvas->Pen->Color = ColorDialog1->Color 5、 编写Image1的OnImage1MouseUp事件,要求实现: 1) 若是第奇数次鼠标按钮弹起,则根据rgDrawWhat的选择,记录直线第一个端点或圆心坐标; 2) 若是第偶数次鼠标按钮弹起,则根据rgDrawWhat的选择,记录直线第二个端点并利用TCanvas的MoveTo()和LineTo()方法画出直线段,或计算出圆的外接矩形后调用TCanvas的Ellipse()方法画圆。-C Builder a new project set the font to Form1 "wherein V" in Form1 add a TRadioGroup components rgDrawWhat options for what painting graphics; Add a Tbutton colorBtn components and a TcolorDialog ColorDialog1 components; Add a TImage component Image1. 3, the current project will be kept in their laboratories folders exp1 Documents folder (to prevent erroneous operation and wasted). Preparation colorBtn the OnClick, ColorDialog1 activated, and access to the choice of colors : if (ColorDialog1- gt; Execute ()) Image1- gt; Canvas- gt; Pen-gt; Color = ColorDialog1- gt; Color 5, the preparation of OnImage1MouseUp Image1, call for : a) If the first odd number of pop-up mouse button, then choose rgDrawWhat the record straight section or an endpoint Center coordinates; 2) If the firs
(系统自动生成,下载前可以参看下载内容)
下载文件列表
exp1
....\Project1.bpr
....\Project1.cpp
....\Project1.exe
....\Project1.obj
....\Project1.res
....\Project1.tds
....\Unit1.cpp
....\Unit1.ddp
....\Unit1.dfm
....\Unit1.h
....\Unit1.obj
....\Project1.bpr
....\Project1.cpp
....\Project1.exe
....\Project1.obj
....\Project1.res
....\Project1.tds
....\Unit1.cpp
....\Unit1.ddp
....\Unit1.dfm
....\Unit1.h
....\Unit1.obj