labellae和label的区别ex有什么区别

1049人阅读
winform(32)
&&&&&&&&& 话说分页这玩意在开发中可是相当的常见。网上到处都是分页的资料。可是在Winform中要做到分页显示文本内容就没有那么容易。而且不能使用一些可以分页的控件,比较DateGridView等。只好在已有的代码基础上开发了一个具备分页功能,并且可以改变行间距的Label。
代码写的比较长,可以拷贝下来直接使用,体验下。
using System.Collections.G
using System.D
using System.T
using System.D
using System.Text.RegularE
&&& public partial class LabelEx : System.Windows.Forms.Label
&&&&&&& int lineDistance = 5;//行间距
&&&&&&& int iHeight = 0, height = 200;
&&&&&&& string[] nrL
&&&&&&& string[] nrLineP
&&&&&&& int searchPos = 0;
&&&&&&& int section = 1;
&&&&&&& int sectionHeight = 5;
&&&&&&& int pageHeight = 100;
&&&&&&& DispMode dm = DispMode.N
&&&&&&& private int pageno = 1;
&&&&&&& private bool isend =//是否尾页
&&&&&&& public event EventHandler EndP
&&&&&&& ///Label所在的容器的高度
&&&&&&& private int containerHeight=0;
&&&&&&& ///Label在容器下端显示不了时附加高度
&&&&&&& private int attachHeight = 20;
&&&&&&& //是否清除文本中的Html文本标签
&&&&&&& private bool fClearHtml =
&&&&&&& [DescriptionAttribute(&&)]
&&&&&&& public bool FClearHtml
&&&&&&&&&&& get { return fClearH }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& fClearHtml =
&&&&&&&&&&& }
&&&&&&& [DescriptionAttribute(&Label在容器下端显示不了时附加高度&)]
&&&&&&& public int AttachHeight
&&&&&&&&&&& get { return attachH }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& attachHeight =
&&&&&&&&&&& }
&&&&&&& [DescriptionAttribute(&Label所在的容器的高度&)]
&&&&&&& public int ContainerHeight &
&&&&&&&&&&& get { return containerH }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& containerHeight =
&&&&&&&&&&& }
&&&&&&& [DescriptionAttribute(&获取或设置行距&)]
&&&&&&& public int LineDistance
&&&&&&&&&&& get { return lineD }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& lineDistance =
&&&&&&&&&&&&&&& Changed(this.Font, this.Width, this.Text);
&&&&&&&&&&& }
&&&&&&& [DescriptionAttribute(&页码,在翻页模式下有用&)]
&&&&&&& public int PageNo
&&&&&&&&&&& get { }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& if (value & 0 && pageno != value)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& if (isend && value&pageno)
&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& pageno =
&&&&&&&&&&&&&&&&&&& this.Refresh();
&&&&&&&&&&&&&&&&&& &
&&&&&&&&&&&&&&& }
&&&&&&&&&&& }
&&&&&&& public LabelEx()
&&&&&&&&&&& : base()
&&&&&&&&&&& //this.TextChanged += new EventHandler(LabelEx_TextChanged);
&&&&&&&&&&& this.SizeChanged += new EventHandler(LabelEx_SizeChanged);
&&&&&&&&&&& this.FontChanged += new EventHandler(LabelEx_FontChanged);
&&&&&&&&&&& //this.Font = new Font(this.Font.FontFamily, this.Font.Size, GraphicsUnit.Pixel);
&&&&&&& void LabelEx_FontChanged(object sender, EventArgs e)
&&&&&&&&&&& Changed(this.Font, this.Width, this.Text);
&&&&&&& void LabelEx_SizeChanged(object sender, EventArgs e)
&&&&&&&&&&& Changed(this.Font, this.Width, this.Text);
&&&&&&& public LabelEx(IContainer container)
&&&&&&&&&&& container.Add(this);
&&&&&&&&&&& //base.Height
&&&&&&&&&&& //InitializeComponent();
&&&&&&& [DescriptionAttribute(&页面高度,在翻页模式下有用&)]
&&&&&&& public int PageHeight
&&&&&&&&&&& get { return pageH }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& pageHeight =
&&&&&&&&&&&&&&& base.Height =
&&&&&&&&&&& }
&&&&&&& [DescriptionAttribute(&呈现模式&)]
&&&&&&& public DispMode DisplayMode
&&&&&&&&&&& get { }
&&&&&&&&&&& set { dm = }
&&&&&&& [DescriptionAttribute(&获取文字高度&)]
&&&&&&& public int FHeight
&&&&&&&&&&& get { return this.Font.H }
&&&&&&& [DescriptionAttribute(&获取行高&)]
&&&&&&& public int LineHeight
&&&&&&&&&&& get { return this.Font.Height + lineD }
&&&&&&& public int SectionHeight
&&&&&&&&&&& get { return this.Font.Height + sectionH }
&&&&&&& [DescriptionAttribute(&设置或获取段落间距&)]
&&&&&&& public int SecDisTance
&&&&&&&&&&& get { return sectionH }
&&&&&&&&&&& set { sectionHeight = }
&&&&&&& public new int Height
&&&&&&&&&&& get { }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& height =
&&&&&&&&&&&&&&& base.Height =
&&&&&&&&&&& }
&&&&&&& public override string Text
&&&&&&&&&&& get
&&&&&&&&&&& {
&&&&&&&&&&&&&&& return base.T
&&&&&&&&&&& }
&&&&&&&&&&& set
&&&&&&&&&&& {
&&&&&&&&&&&&&&& //is.Font.Size. &
&&&&&&&&&&&&&&& if (FClearHtml)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& base.Text=
&&&&&&&&&&&&&&&&&&& string strText = base.T
&&&&&&&&&&&&&&&&&&& strText = ClearHtml(strText);
&&&&&&&&&&&&&&&&&&& base.Text = strT
&&&&&&&&&&&&&&&&&&& Changed(this.Font, this.Width, strText);
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& base.Text =
&&&&&&&&&&&&&&&&&&& Changed(this.Font, this.Width, value);
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& &
&&&&&&&&&&& }
&&&&&&& public bool IsEnd
&&&&&&&&&&& get { }
&&&&&&& protected void Changed(Font ft, int iWidth, string value)
&&&&&&&&&&& iHeight = 0;
&&&&&&&&&&& if (value != &&)
&&&&&&&&&&& {
&&&&&&&&&&&&&&& if (gcs == null)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& gcs = this.CreateGraphics();
&&&&&&&&&&&&&&&&&&& SizeF sf0 = gcs.MeasureString(new string('测', 20), ft);
&&&&&&&&&&&&&&&&&&& searchPos = (int)(iWidth * 20 / sf0.Width);
&&&&&&&&&&&&&&&&&&& if (searchPos & 2) searchPos -= 2;
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& nrLine = value.Split(new string[1] { &\r\n& }, StringSplitOptions.RemoveEmptyEntries);
&&&&&&&&&&&&&&& section = nrLine.L
&&&&&&&&&&&&&&& nrLinePos = new string[section];
&&&&&&&&&&&&&&& SizeF sf1, sf2;
&&&&&&&&&&&&&&& string temps,
&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& int temPos,
&&&&&&&&&&&&&&& for (int i = 0; i & i++)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& ipos = 0;
&&&&&&&&&&&&&&&&&&& temPos = searchP
&&&&&&&&&&&&&&&&&&& if (searchPos &= nrLine[i].Length)
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& ipos += nrLine[i].L
&&&&&&&&&&&&&&&&&&&&&&& nrLinePos[i] += &,& + ipos.ToString();
&&&&&&&&&&&&&&&&&&&&&&& iHeight++;
&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& drawstring = nrLine[i];
&&&&&&&&&&&&&&&&&&& nrLinePos[i] = &&;
&&&&&&&&&&&&&&&&&&& while (drawstring.Length & searchPos)
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& bool isfind =
&&&&&&&&&&&&&&&&&&&&&&& for (int j = searchP j & drawstring.L j++)
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& temps = drawstring.Substring(0, j);
&&&&&&&&&&&&&&&&&&&&&&&&&&& tempt = drawstring.Substring(0, j + 1);
&&&&&&&&&&&&&&&&&&&&&&&&&&& sf1 = gcs.MeasureString(temps, ft);
&&&&&&&&&&&&&&&&&&&&&&&&&&& sf2 = gcs.MeasureString(tempt, ft);
&&&&&&&&&&&&&&&&&&&&&&&&&&& if (sf1.Width & iWidth && sf2.Width & iWidth)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& iHeight++;
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ipos +=
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& nrLinePos[i] += &,& + ipos.ToString();
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& isfind =
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& drawstring = drawstring.Substring(j);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& if (!isfind)
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& //drawstring = drawstring.Substring(searchPos);
&&&&&&&&&&&&&&&&&&&&&&&&&&& //iHeight++;
&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& ipos += drawstring.L
&&&&&&&&&&&&&&&&&&& nrLinePos[i] += &,& + ipos.ToString();
&&&&&&&&&&&&&&&&&&& iHeight++;
&&&&&&&&&&&&&&&&&&& //tempLine = (int)(sf1.Width - 1) / this.Width + 1;&&&&&&&&&&&&&&&&&&&&&& &
&&&&&&&&&&&&&&&&&&& //iHeight += tempL
&&&&&&&&&&&&&&& }
&&&&&&&&&&& }
&&&&&&&&&&& if (dm == DispMode.None)
&&&&&&&&&&& {
&&&&&&&&&&&&&&& //this.Height = iHeight * (ft.Height + lineDistance) + (section - 1) * (sectionHeight - lineDistance);
&&&&&&&&&&&&&&& //add by kevin gao
--------------begine
&&&&&&&&&&&&&&& if (value == &&)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& this.Height = 0;
&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& if (this.ContainerHeight == 0)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& this.Height = iHeight * (ft.Height + lineDistance) + (section - 1) * (sectionHeight - lineDistance);
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& int tmpHeight = 0;
&&&&&&&&&&&&&&&&&&& int fHeight = ft.H
&&&&&&&&&&&&&&&&&&& for (int i = 0; i & i++)
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& int iLineNum = 0;
&&&&&&&&&&&&&&&&&&&&&&& if (nrLinePos[i] == null || nrLinePos[i] == &&)
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& string strLinePos = nrLinePos[i].TrimStart(',');
&&&&&&&&&&&&&&&&&&&&&&& iLineNum = strLinePos.Split(',').L
&&&&&&&&&&&&&&&&&&&&&&& for (int j = 0; j & iLineN j++)
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& int iTop = this.Top + tmpH
&&&&&&&&&&&&&&&&&&&&&&&&&&& if (ContainerHeight == 0)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& //if (this.Top & 0)
&&&&&&&&&&&&&&&&&&&&&&&&&&& //{
&&&&&&&&&&&&&&&&&&&&&&&&&&& //&&& iTop = ContainerHeight + this.Top + tmpH
&&&&&&&&&&&&&&&&&&&&&&&&&&& //}
&&&&&&&&&&&&&&&&&&&&&&&&&&& int RelTop = iTop % ContainerH
&&&&&&&&&&&&&&&&&&&&&&&&&&& int TempHeight = 0;
&&&&&&&&&&&&&&&&&&&&&&&&&&& if (j == iLineNum - 1)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& TempHeight = RelTop + (fHeight + sectionHeight);
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& TempHeight = RelTop + (fHeight + lineDistance);
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& if (TempHeight & ContainerHeight)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (RelTop + fHeight & containerHeight)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& AttachHeight = ContainerHeight - RelT
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& tmpHeight += AttachH
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //tmpHeight += TempHeight - ContainerHeight + 2;
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& if (j == iLineNum - 1)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& tmpHeight += fHeight + sectionH
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& tmpHeight += fHeight + lineD
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& this.Height = tmpH
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& //add by kevin gao
--------------end
&&&&&&&&&&& }
&&&&&&& protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
&&&&&&&&&&& //base.OnPaint(e);&&&&&&&&& &
&&&&&&&&&&& //if (isPaint)
&&&&&&&&&&& //isPaint =
&&&&&&&&&&& Graphics g = e.G
&&&&&&&&&&& String drawString = this.T
&&&&&&&&&&& Font drawFont = this.F
&&&&&&&&&&& SolidBrush drawBrush = new SolidBrush(this.ForeColor);
&&&&&&&&&&& SizeF textSize = g.MeasureString(this.Text, this.Font);//文本的矩形区域大小& &
&&&&&&&&&&& int lineCount = Convert.ToInt16(textSize.Width / this.Width) + 1;//计算行数& &
&&&&&&&&&&& int fHeight = this.Font.H
&&&&&&&&&&& int htHeight = 0;
&&&&&&&&&&& bool isPageStart =
&&&&&&&&&&& this.AutoSize =
&&&&&&&&&&& float x = 0.0F;
&&&&&&&&&&& StringFormat drawFormat = new StringFormat();
&&&&&&&&&&& lineCount = drawString.L//行数不超过总字符数目& &
&&&&&&&&&&& int i, idx,
&&&&&&&&&&& string subStr, tmpStr = &&, midStr = &&;
&&&&&&&&&&& string[]
&&&&&&&&&&& int tmpPage = 1;
&&&&&&&&&&& isend =
&&&&&&&&&&& string preLineStr = &&;
&&&&&&&&&&& for (i = 0; i & i++)
&&&&&&&&&&& {
&&&&&&&&&&&&&&& if (i == 10)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& first = 0;
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& first = 0;
&&&&&&&&&&&&&&& subStr = nrLine[i];
&&&&&&&&&&&&&&& if (nrLinePos[i] != null) tmpStr = nrLinePos[i].TrimStart(',');
&&&&&&&&&&&&&&& midStr = subStr.Substring(first);
&&&&&&&&&&&&&&& if (tmpStr != &&)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& idxs = tmpStr.Split(',');
&&&&&&&&&&&&&&&&&&& for (int j = 0; j & idxs.L j++)
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& idx = int.Parse(idxs[j]);&&&&&&&&&&&&&&&&&&&&& &
&&&&&&&&&&&&&&&&&&&&&&& midStr = subStr.Substring(first, idx - first);
&&&&&&&&&&&&&&&&&&&&&&& if (dm == DispMode.None)
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& //add by kevin gao
&&&&&&&&&&&&&&&&&&&&&&&&&&& if (ContainerHeight == 0)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Graphics.DrawString(midStr, drawFont, drawBrush, x, Convert.ToInt16(htHeight), drawFormat);
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& int iTop = this.Top + htH
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (this.Top & 0)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& iTop = ContainerHeight + this.Top + htH
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& int RelTop = iTop % ContainerH
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& int TempHeight = 0;
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (j == idxs.Length - 1)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& TempHeight = RelTop + (fHeight + sectionHeight);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& TempHeight = RelTop + (fHeight + lineDistance);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (TempHeight & ContainerHeight)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (RelTop + fHeight & containerHeight)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& AttachHeight = ContainerHeight - RelT
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& htHeight += AttachH
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Graphics.DrawString(midStr, drawFont, drawBrush, x, Convert.ToInt16(htHeight), drawFormat);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Graphics.DrawString(midStr, drawFont, drawBrush, x, Convert.ToInt16(htHeight), drawFormat);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Graphics.DrawString(midStr, drawFont, drawBrush, x, Convert.ToInt16(htHeight), drawFormat);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& //add by kevin gao
&&&&&&&&&&&&&&&&&&&&&&&&&&& //e.Graphics.DrawString(midStr, drawFont, drawBrush, x, Convert.ToInt16(htHeight), drawFormat);
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& if ((htHeight + fHeight) & pageHeight)
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& tmpPage++;
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (tmpPage & pageno)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //e.Graphics.DrawString(midStr, drawFont, drawBrush, x, Convert.ToInt16(htHeight), drawFormat);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& this.Height = htHeight + fH
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (i == section - 1 && j == idxs.Length - 1)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& isend =
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (EndPage != null)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& EndPage(this, e);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& preLineStr = midS
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& isPageStart =
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& htHeight = 0;
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (tmpPage == pageno)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (isPageStart)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Graphics.DrawString(preLineStr, drawFont, drawBrush, x, 0, drawFormat);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& isPageStart =
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Graphics.DrawString(midStr, drawFont, drawBrush, x, Convert.ToInt16(htHeight), drawFormat);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (i == section - 1 && j == idxs.Length - 1)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& isend =
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (EndPage != null)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& EndPage(this, e);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& if (j == idxs.Length - 1)
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& htHeight += (fHeight + sectionHeight);
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& htHeight += (fHeight + lineDistance);
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& first =
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& }
&&&&&&&&&&& }
&&&&&&& /// &summary&
&&&&&&& /// 清除文本中的Html标签
&&&&&&& /// &/summary&
&&&&&&& /// &param name=&patrn&&要替换的标签正则表达式&/param&
&&&&&&& /// &param name=&strRep&&替换为的内容&/param&
&&&&&&& /// &param name=&content&&要替换的内容&/param&
&&&&&&& /// &returns&&/returns&
&&&&&&& private string Zxj_ReplaceHtml(string patrn, string strRep, string content)
&&&&&&&&&&& if (string.IsNullOrEmpty(content))
&&&&&&&&&&& {
&&&&&&&&&&&&&&& content = &&;
&&&&&&&&&&& }
&&&&&&&&&&& Regex rgEx = new Regex(patrn, RegexOptions.IgnoreCase);
&&&&&&&&&&& string strTxt = rgEx.Replace(content, strRep);
&&&&&&&&&&& return strT
&&&&&&& /// &summary&
&&&&&&& /// 清除文本中Html的标签
&&&&&&& /// &/summary&
&&&&&&& /// &param name=&Content&&&/param&
&&&&&&& /// &returns&&/returns&
&&&&&&& private string ClearHtml(string Content)
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&#[^&]*;&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?marquee[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?object[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?param[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?embed[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?table[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?tr[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?th[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?p[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?a[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?img[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?tbody[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?li[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?span[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?div[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?th[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?td[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?script[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&(javascript|jscript|vbscript|vbs):&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&on(mouse|exit|error|click|key)&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&\\?xml[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&\\/?[a-z]+:[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?font[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?b[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?u[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?i[^&]*&&, &&, Content);
&&&&&&&&&&& Content = Zxj_ReplaceHtml(&&/?strong[^&]*&&, &&, Content);
&&&&&&&&&&& string clearHtml = C
&&&&&&&&&&& return clearH
&&& /// &summary&
&&& /// 显示模式,分为全显示和分页显示两种
&&& /// &/summary&
&&& public enum DispMode
&&&&&&& None = 0,
&&&&&&& Page = 1
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:597878次
积分:8712
积分:8712
排名:第2062名
原创:254篇
转载:168篇
评论:110条
(9)(4)(1)(7)(1)(3)(25)(4)(5)(8)(2)(5)(9)(5)(8)(9)(6)(12)(1)(7)(7)(13)(13)(9)(4)(4)(14)(5)(7)(4)(4)(4)(3)(5)(14)(13)(13)(6)(7)(4)(22)(37)(51)(8)(22)

我要回帖

更多关于 span和label的区别 的文章

 

随机推荐