概述
Code
void MyData()
{
int middle = 5;
int allCount = 15;
int rowCount = 1;
int iPageTotal = (allCount + middle - 1) / middle;
for (int i = 0; i < allCount; i++)
{
if (rowCount % 2 != 0) //奇数行 顺行
{
int oddNumber = (i + (middle));
int nowNumber = 0;
if (oddNumber > allCount)
oddNumber = allCount - 1;
for (int j = i; j < oddNumber; j++)
{
Response.Write("<font color='red'>" +list[j].NodeSN+ "</font> ");
nowNumber = j;
}
i = nowNumber;
Response.Write("<br>");
rowCount++;
}
if (rowCount % 2 == 0) //偶数行 逆行
{
int even = (i + middle);
int end = even - (middle);
string test = "";
for (int j = even; j > end; j--)
{
if (j >= allCount)
{
test += " ";
Response.Write("" + test);
}
else
Response.Write("<font color='green'>" + list[j].NodeSN + "</font> ");
}
Response.Write("<br>");
i = even;
rowCount++;
}
if (rowCount == iPageTotal)
break;
}
void MyData()
{
int middle = 5;
int allCount = 15;
int rowCount = 1;
int iPageTotal = (allCount + middle - 1) / middle;
for (int i = 0; i < allCount; i++)
{
if (rowCount % 2 != 0) //奇数行 顺行
{
int oddNumber = (i + (middle));
int nowNumber = 0;
if (oddNumber > allCount)
oddNumber = allCount - 1;
for (int j = i; j < oddNumber; j++)
{
Response.Write("<font color='red'>" +list[j].NodeSN+ "</font> ");
nowNumber = j;
}
i = nowNumber;
Response.Write("<br>");
rowCount++;
}
if (rowCount % 2 == 0) //偶数行 逆行
{
int even = (i + middle);
int end = even - (middle);
string test = "";
for (int j = even; j > end; j--)
{
if (j >= allCount)
{
test += " ";
Response.Write("" + test);
}
else
Response.Write("<font color='green'>" + list[j].NodeSN + "</font> ");
}
Response.Write("<br>");
i = even;
rowCount++;
}
if (rowCount == iPageTotal)
break;
}
结果为:
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
转载于:https://www.cnblogs.com/wlhc_Jing/archive/2008/12/27/1363656.html
最后
以上就是活力芹菜为你收集整理的z字行 数据输出的全部内容,希望文章能够帮你解决z字行 数据输出所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复