| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦   
共有 377 人关注过本帖
标题:有关字体
收藏  订阅  推荐  打印
mthupc
Rank: 1
等级:新手上路
帖子:8
积分:188
注册:2007-10-24
有关字体

朋友们,通过下面两段代码,希望能指点兄弟一下:6.0的textheight、textwidth与2005的MeasureString(,)区别在哪儿,为什么二者输出结果值差别这么大?或者各自到底指的是什么?好郁闷!
谢谢了!

vb6.0

Private Sub Command1_Click()
Me.Font.Name = "Arial"
Me.Font.Size = 24
          Me.Font.Bold = True
          Me.ForeColor = vbRed
          Print "Hello   World!"
          Line (0, 0)-(TextWidth("Hello   World!"), TextHeight("Hello   World!")), vbBlack, B
          MsgBox Str(TextHeight("Hello   World!"))
End Sub




vb2005

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim g As System.Drawing.Graphics
        g = Me.CreateGraphics

        Dim TextFont As New System.Drawing.Font("Arial", 24, FontStyle.Bold)
        MsgBox(TextFont.Height.ToString)

        Dim TextBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Red)
        g.DrawString("Hello   World!", TextFont, TextBrush, 10, 10)
        Dim TextSize As New System.Drawing.SizeF
        TextSize = g.MeasureString("Hello   World!", TextFont)
        g.DrawRectangle(Pens.Black, 10, 10, TextSize.Width, TextSize.Height)
        MsgBox(Str(TextSize.Height))
        TextFont.Dispose()
        TextBrush.Dispose()
    End Sub
2008-7-25 22:40
共有 376 人关注过本帖
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.050525 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved