新聞中心
如何實現(xiàn)VB.NET文字寬度計算
Dim MyGraphics As Graphics = Me.CreateGraphics
成都創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比慶安網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式慶安網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋慶安地區(qū)。費用合理售后完善,十年實體公司更值得信賴。
'定義使用的字體
Dim Myfont As New Font("宋體", 9)
'獲取文本的大小。
Dim Mystring_Size As SizeF = MyGraphics.MeasureString("中", Myfont)
'顯示寬和高
MsgBox(Mystring_Size1.Width ":" Mystring_Size1.Height)
vb.net 代碼調(diào)整字體大小
看樣要重新定義個Font對象,在構(gòu)造函數(shù)中定義它的大小,
With Button1.Font
Button1.Font = New Font(.FontFamily, 34, .Style, .Unit) '參數(shù)都用原來字體參數(shù),只有大小改成你需要的。
End With
VB.net中如何在代碼中設(shè)置文本框字體的大小
Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Dim a As FontStyle
a = Me.TextBox1.Font.Size
Dim b As Single = a * 10
Me.TextBox1.Width = Me.TextBox1.Width * 10
Me.TextBox1.Font = New System.Drawing.Font("PMingLiU ", b, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) '放大10倍,若僅10號字體,則將b改為10
End Sub
如何設(shè)置VB.NET中代碼的字體大小,和是否換行,這些選項在哪里?
沒有自動換行,因為VB語句不能隨便換行,字體可以設(shè)置,點菜單-》工具-》選項-》字體和顏色
分享標(biāo)題:vb.net文字大小 vbnet font
文章源于:http://www.dlmjj.cn/article/doeopco.html