Warning: file_get_contents() [function.file-get-contents]: SSL: 远程主机强迫关闭了一个现有的连接。 in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884

Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
计算文本在按钮中居中时的坐标算法 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


x表示横轴,y表示竖轴。

设按钮起点坐标为start.x,start.y,终点坐标为finish.x,finish.y;

文本的长度为width,高度为height;文本的起始坐标为text.x,text.y。

那么得到以下结论:


要使文字居中于按钮内部,文字的坐标需为:

text.x = (finish.x - start.x - width) / 2 + start.x

text.y = (finish.y - start.y - height) / 2 + start.y




返回首页


Copyright (C) 2018-2024 huidong