[事件]在使用visual studioasp.net時想要讓Label呈現一大堆文字

既不要擠在一起,還要可以句首空兩格

或是可以顯現多段落的情況

像是

  1. item number 1
  2. item number 2
  3. ……

 

[解決方法]

不要使用Label!

Label無法達到以上要求,最好的辦法是換成textbox

並在property的地方更改下列屬性

Wrap = true;
rows = {some number greater than 0} (大於零值比使用height排版容易)
ReadOnly = true
TextMode = multiline
BorderStyle = None
BorderWidth = 0

 

最後的border屬性相當重要,可使textbox看起來像Label

 

參考網址:

http://geekswithblogs.net/StealThisCode/archive/2006/03/21/WrapLabels.aspx

arrow
arrow
    全站熱搜

    lilianecc 發表在 痞客邦 留言(0) 人氣()