我們自己寫了一個Grid。 其中一個功能是根據每列的數據, 計算出每一列的最小寬度, 然后用 style="width:90px" 的方式Render出來。 其中涉及到根據每一行字符串的長度轉換成Pixel。然后取最大值。
具體的轉換關系是:
1 point = 1/72 inch
1 pixel = 0.75 points.
那么一個character 是多少Pixels呢? 答案是這條公式: (Column Width) Pixels = Column Width (Characters) × 5 + 5。
例如 "Hello World" 是 11×5+5=60 Pixels。
轉自:http://sunnylei2008.blogspot.com/2007/09/blog-post_1295.html
具體的轉換關系是:
1 point = 1/72 inch
1 pixel = 0.75 points.
那么一個character 是多少Pixels呢? 答案是這條公式: (Column Width) Pixels = Column Width (Characters) × 5 + 5。
例如 "Hello World" 是 11×5+5=60 Pixels。
轉自:http://sunnylei2008.blogspot.com/2007/09/blog-post_1295.html