![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif) Code
void DataBind()
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif) {
List<TestChart> list = new List<TestChart>();
for (int i = 0; i <15; i++)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
TestChart tc = new TestChart
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
StrImagePath = "image/user.jpg",
StrDescription = "描述: " + (i + 1),// + string.Format(vmlLine, left),
NodeSN = (i + 1)
};
list.Add(tc);
}
MyData(list);
}
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif) /**//// <summary>
/// 画流程图
/// </summary>
/// <param name="list"></param>
void MyData(List<TestChart> list)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif) {
string responseText = "";
string vmlLine = " <v:line strokeweight='3px' Style='LEFT:0px; POSITION:relative;' to='100,0' strokeColor='blue' fillcolor='blue'><v:stroke EndArrow='Classic' > </v:stroke></v:line>";
string vmlBrLine = "<v:line strokeweight='3px' Style='LEFT:10px;TOP:5PX POSITION:relative;' to='0,20' strokeColor='blue' fillcolor='blue'><v:stroke EndArrow='Classic'> </v:stroke></v:line>";
string reverseLine = " <v:line strokeweight='3px' Style='LEFT:0px; POSITION:relative;' to='100,0' strokeColor='blue' fillcolor='blue'><v:stroke StartArrow='Classic'> </v:stroke></v:line>";
//一行显示多少个
int middle = 4;
int allCount = list.Count;
int rowCount = 1;
int iPageTotal = (allCount + middle - 1) / middle;
string firefox = Request.UserAgent;
if (firefox.Contains("Firefox"))
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
vmlBrLine = "↓";
vmlLine = "---------→";
reverseLine = "←--------";
}
StringBuilder table = new StringBuilder("<table>");
for (int i = 0; i < allCount; i++)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
if (rowCount % 2 != 0) //奇数行 顺行
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
int oddNumber = (i + (middle));
int nowNumber = 0;
if (oddNumber > allCount)
oddNumber = allCount ;
table.Append("<tr>");
//最后一行
if (i == (allCount - 1))
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
table.Append("<td><font color='red'>" + list[i].NodeSN + "</font> " + "<img src='" + list[i].StrImagePath + "'/>" + list[i].StrDescription + "</td></tr>");
break;
}
for (int j = i; j < oddNumber; j++)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
if (j != (oddNumber -1))
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
table.Append("<td><font color='red'>" + list[j].NodeSN + "</font> " + "<img src='" + list[j].StrImagePath + "'/>" + list[j].StrDescription + vmlLine+"</td>");
}
else
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
table.Append("<td><font color='red'>" + list[j].NodeSN + "</font> " + "<img src='" + list[j].StrImagePath + "'/>" + list[j].StrDescription+"</td>");
}
nowNumber = j;
}
i = nowNumber;
//最后一行不显示向下的箭头
if(rowCount!=iPageTotal)
table.Append("</tr><tr><td colspan='" + middle + "' align='right' style='padding-right:30px'>" + vmlBrLine + "</td></tr>");
}
if (rowCount % 2 == 0) //偶数行 逆行
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
int even = (i + middle-1);
int end = even - (middle);
string test = "";
table.Append("<tr>");
for (int j = even; j > end; j--)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
if (j >= allCount)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
table.Append("<td> </td>");
responseText += ("" + test);
}
else
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
if ((j - 1) == (end))
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
table.Append("<Td><font color='green'>" + list[j].NodeSN + "</font> " + "<img src='" + list[j].StrImagePath + "'/>" + list[j].StrDescription+"</td>");
}
else
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
table.Append ("<td><font color='green'>" + list[j].NodeSN + "</font> " + "<img src='" + list[j].StrImagePath + "'/>" + list[j].StrDescription + reverseLine+"</td>");
}
}
}
i = even;
if (rowCount<iPageTotal)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
table.Append("</tr><tr><td colspan='" + middle + "' align='left'>" + vmlBrLine + "</td></tr>");
}
else
table.Append("</tr>");
}
if ((rowCount) == iPageTotal)
break;
rowCount++;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
}
table.Append("</table>");
testLine.InnerHtml = table.ToString();
}
struct TestChart
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif) {
private string _strImagePath;
private string _strDescription;
private int _nodeSN;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 图片路径
/// </summary>
public string StrImagePath
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return _strImagePath; }
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) set { _strImagePath = value; }
}
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 描述
/// </summary>
public string StrDescription
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return _strDescription; }
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) set { _strDescription = value; }
}
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
/// 序号
/// </summary>
public int NodeSN
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return _nodeSN; }
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) set { _nodeSN = value; }
}
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
}
|