string t="";
float x = (float)e.X;
float y = (float)e.Y;
float w = (float)e.Width;
float h = (float)e.Height;
float left = x - w / 2.0f;
float top = y - h / 2.0f;
//解析线段
float bwidth = (float)e.BorderWidth;
string bcolor = e.BorderColorString;
if (e.TopBorder == true)
{
t += "<img id='" + e.OID + "_1' style='padding:0px;position:absolute;left:" + left + "px;top:" + top + "px;width:" + w + "px;height:" + bwidth + "px;background-color:" + bcolor + ";' />";
}
if (e.LeftBorder == true)
{
t += "<img id='" + e.OID + "_2' style='padding:0px;position:absolute;left:" + left + "px;top:" + top + "px;width:" + bwidth + "px;height:" + h + "px;background-color:" + bcolor + ";' />";
}
if (e.RightBorder == true)
{
float right = left + w;
t += "<img id='" + e.OID + "_3' style='padding:0px;position:absolute;left:" + right + "px;top:" + top + "px;width:" + bwidth + "px;height:" + h + "px;background-color:" + bcolor + ";' />";
}
if (e.BottomBorder == true)
{
float bottom = top + h;
t += "<img id='" + e.OID + "_4' style='padding:0px;position:absolute;left:" + left + "px;top:" + bottom + "px;width:" + w + "px;height:" + bwidth + "px;background-color:" + bcolor + ";' />";
//
}
用html中img元素画横竖直线的方法
最新推荐文章于 2023-01-09 16:14:22 发布