我做的东西,需要用Canvas画线,但是得绕过一些可视控件,就像电路图一样,不定的
两个管脚画线要绕过其他集成块,又不能给每一个都编一个固定的函数,灵活性太差。
请大家帮帮我,谢谢 !
两个管脚画线要绕过其他集成块,又不能给每一个都编一个固定的函数,灵活性太差。
请大家帮帮我,谢谢 !
解决方案 »
- Image 坐标转换问题
- 我的SQL语法有问题,请各位帮我看一下。
- 多个客户端同时从服务器端下载一个文件,下面代码流程是否有问题?我怎么老出错?
- 在SQL SERVER2000中,我怎么知道有那些客户端在访问服务器,是程序访问还是查询分析器访问
- 关于Qucik Report报表换页的问题
- HELP:动态的GIF,为什么在DLL的窗体中无法刷新,变成了静态图片 [在线等待]
- ★怎样让PC喇叭发出“Bi”的一声?
- 利用webbrowser编写王爷浏览程序的字体显示问题
- opendriver函数的使用方法。
- 大家好,请Delphi高手帮小弟一把。问题:用户打开不同的逻辑盘Win发送的消息是什么?怎样截获?谢谢!
- 怎样才能让Form1中的数据控制组件连上DataModule里面的DataSource?
- 安装delphi5出现的问题:请大虾指点,急!
然后自定义一个判断的函数
每画一根线的时候,调用判断,根据返回值处理
1.直线
2.绕一下,无非就是加了三条直线,或者可以直接polyline(是不是这个函数?)
var
k : double;
begin
//循环检测,是否遮挡
//根据直线的斜率,分为两种情况:有斜率,无斜率,分别处理
if x1 = x2 then //无斜率
begin
if ((y1<PosArray[1].Top)and(y2>PosArray[1].Bottom))
or ((y2<PosArray[1].Top)and(y1>PosArray[1].Bottom)) then
begin
Result := True;
zhedangPoint[iCount].X := x1;
zhedangPoint[iCount].Y := PosArray[1].Top;
Inc(iCount);
zhedangPoint[iCount].X := x1;
zhedangPoint[iCount].Y := PosArray[1].Bottom ;
Inc(iCount);
end
else
result := False;
end
else //有斜率
begin
if y1 = y2 then //水平,少一个判断
begin
if ((x1<PosArray[1].Left)and(x2>PosArray[1].Right))
or ((x2<PosArray[1].Left)and(x1>PosArray[1].Right)) then
begin
Result := True;
zhedangPoint[iCount].X := PosArray[1].Left;
zhedangPoint[iCount].Y := y1;
Inc(iCount);
zhedangPoint[iCount].X := PosArray[1].Right;
zhedangPoint[iCount].Y := y1;
Inc(iCount);
end
else
Result := False;
end
else //任意
begin
k := (y1-y2) / (x1-x2);
if (True) then
;//分别判断四条线的情况,代码太多不写了
end;
end;
end;自己完善吧,不断实验
TPosition = Record
Left : integer;
Top : integer;
Right : integer;
Bottom : integer;
end;
private
{ Private declarations }
PosArray : Array [1..20] of TPosition;
zhedangPoint : Array [1..20] of TPoint;赋值,这个偶不会,不写了,我要吃饭了。