نمی دونم شاید کسی حوصله دانلود کردن نداره.
کدها رو هم می زارم. منتظر راهنمایی هستم.
public void LoadData()
{
OleDbDataReader dr = DBase.ExecuteReader(System.Data.CommandType.Text, "select * from tbl", new OleDbParameter[]{
});
while (dr.Read())
{
Literal2.Text = dr["tb_title"].ToString();
Literal3.Text = dr["tb_abs"].ToString();
}
lblnumberoftotalchar.Text = CountTotalChars(Literal2.Text).ToString();
long CTotalChars = CountTotalChars(Literal2.Text);
string titr = Literal2.Text;
string[] separators = new string[] { "\r\n" };
string[] result;
int L =35;
int line = 0;
result = titr.Split(new string[] { "\r\n" }, StringSplitOptions.None);
//if (result.Length<=5)
//{
//}
if (result.Length > 0)
{
Response.Write("result 0=" + result[0]);
}
if (result.Length > 1)
{
Response.Write("result 1=" + result[1]);
}
if (result.Length > 2)
{
Response.Write("result 2=" + result[2]);
}
if (result.Length > 3)
{
Response.Write("result 3=" + result[3]);
}
if (result.Length > 4)
{
Response.Write("result 4=" + result[4]);
}
if (result.Length > 5)
{
Response.Write("result 5=" + result[5]);
}
Label1.Text = result.Length.ToString();
Literal2.Text = Literal2.Text.Replace("\r\n", "<br>");
switch (result.Length)
{
case 1:
if (CTotalChars > 100)
{
Literal3.Visible = false;
}
break;
case 2://1 enter
// enter in line one
//long s2 = CTotalChars - result[0].Length;
// طول تقریبی یک خط 40
if (result[0].Length<L)// enter in line one
{
line++;
//long s2 = CTotalChars - L;
if (result[1].Length>3*L)
{
Literal3.Visible = false;
}
}
if ((L < result[0].Length) && (result[0].Length < 2*L))//enter in line two
{
line++;
//long s2 = CTotalChars - 2*L;
if (result[1].Length > 2*L)
{
Literal3.Visible = false;
}
}
if ((2*L < result[0].Length) && (result[0].Length < 3 * L))//enter in line three
{
line++;
//long s2 = CTotalChars - 2*L;
if (result[1].Length > 1 * L)
{
Literal3.Visible = false;
}
}
if ((2 * L < result[0].Length) & (result[0].Length < 4 * L))//enter in line four
{
line++;
//long s2 = CTotalChars - 2*L;
if (result[1].Length > 0 * L)
{
Literal3.Visible = false;
}
}
if ((3 * L < result[0].Length) & (result[0].Length < 5 * L))//enter in line five
{
Literal3.Visible = false;
}
break;
case 3://2 enter
if (result[0].Length<L)
{
if (result[1].Length<L) //enter in line one and two
{
if (result[2].Length>3*L)
{
Literal3.Visible = false;
}
}
if (result[1].Length > L & result[1].Length < 2*L) //enter in line one and three
{
if (result[2].Length > 2 * L)
{
Literal3.Visible = false;
}
}
if (result[1].Length > 2*L & result[1].Length < 3 * L) //enter in line one and four
{
if (result[2].Length > 1 * L)
{
Literal3.Visible = false;
}
}
if (result[1].Length > 3 * L & result[1].Length < 4 * L) //enter in line one and five
{
Literal3.Visible = false;
}
}
if (result[0].Length < 2 * L & result[0].Length > L)//first enter in line two
{
if (result[1].Length > 2 * L & result[1].Length < 3 * L)//enter in line two and three
{
Literal3.Visible = false;
}
if (result[1].Length > 3 * L & result[1].Length < 4 * L)//enter in line two and four
{
Literal3.Visible = false;
}
if (result[1].Length > 4 * L & result[1].Length <5*L)//enter in line two and five
{
Literal3.Visible = false;
}
}
if (result[0].Length < 3 * L & result[0].Length >2* L)//first enter in line three
{
if (result[1].Length>0 & result[1].Length <2*L )//enter in line three and four
{
if (result[2].Length>L)
{
Literal3.Visible = false;
}
}
if (result[1].Length>L & result[1].Length < 3 * L)//enter in line three and five
{
Literal3.Visible = false;
}
}
if (result[0].Length>3*L & result[1].Length<2*L)//enter in line four and five
{
Literal3.Visible = false;
}
break;
case 4://3 enter
if (result[0].Length<L)
{
if (result[1].Length<L & result[2].Length<L)//enter in line one,two,three
{
if (result[3].Length > 2 * L)
{
Literal3.Visible = false;
}
}
if (result[1].Length < L)//enter in line one,two,four
{
if (result[2].Length<2*L & result[2].Length <3*L)
{
if (result[3].Length > L)
{
Literal3.Visible = false;
}
}
}
if (result[1].Length < L)//enter in line one,two,five
{
if (result[2].Length < 3 * L & result[2].Length < 4 * L)
{
Literal3.Visible = false;
}
}
//one,three,four
if (result[1].Length <3*L & result[1].Length>L)
{
if (result[2].Length < 2*L & result[2].Length>0)
{
if (result[3].Length>0)
{
Literal3.Visible = false;
}
}
}
//one,three,five
if (result[1].Length < 3 * L & result[1].Length > L)
{
if (result[2].Length < 3 * L & result[2].Length > L)
{
Literal3.Visible = false;
}
}
}
if (result[0].Length>L & result[0].Length <2*L)//enter in line two, three, four*************
{
if (result[1].Length <2*L & result[1].Length>0)
{
if (result[2].Length<2*L & result[2].Length>0 )
{
if (result[3].Length>L)
{
Literal3.Visible = false;
}
}
}
}
if (result[0].Length > L & result[0].Length < 2 * L)//enter in line two, three, five
{
if (result[1].Length < 2 * L & result[1].Length > 0)
{
if (result[2].Length < 3 * L & result[2].Length > L)
{
Literal3.Visible = false;
}
}
}
if (result[0].Length > 2*L & result[0].Length < 3 * L)//enter in line three, four, five
{
if (result[1].Length < 2 * L & result[1].Length > 0)
{
if (result[2].Length <2*L & result[2].Length >0)
{
Literal3.Visible = false;
}
}
}
break;
case 5://4 enter
if (result[0].Length < L)
{
if (result[1].Length < L & result[2].Length < L & result[3].Length<L)//enter in line one,two,three,four
{
if (result[4].Length > L)
{
Literal3.Visible = false;
}
}
}
if (result[0].Length < L)//enter in line one,two,three,five
{
if (result[1].Length < L & result[2].Length < L)
{
if (result[3].Length<3*L & result[3].Length<L)
{
Literal3.Visible = false;
}
}
}
if (true)//enter in line one,three,four,five
{
if (result[0].Length<L)
{
if (result[1].Length<3*L & result[1].Length>L)
{
if (result[2].Length < 2*L & result[2].Length >0)
{
if (result[3].Length<2*L & result[3].Length<0)
{
if (result[4].Length>0)
{
Literal3.Visible = false;
}
}
}
}
}
}
if (true)//enter in line one,two,four,five
{
if (result[0].Length<L)
{
if (result[1].Length<2*L & result[1].Length>0)
{
if (result[2].Length<3*L & result[1].Length>L)
{
if (result[3].Length <2*L & result[3].Length >0)
{
Literal3.Visible = false;
}
}
}
}
}
break;
case 6: // 5 enter
Literal3.Visible = false;
break;
default:
break;
}
}