真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net安裝字體 vb中字體

VB.NET,Richtextbox的bold設(shè)置

斜粗體是用 Or 合并;

合水網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項目制作,到程序開發(fā),運營維護。成都創(chuàng)新互聯(lián)于2013年成立到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)

Ft?=?New?Font("宋體",?9.0!,?CType((FontStyle.Bold?Or?FontStyle.Italic),?FontStyle))

也可以在設(shè)定粗體前先保存原有字體,可以方便還原;

Private?OldFont?As?Font?'舊的字體

OldFont?=?RichTextBox1.SelectionFont?'保存當(dāng)前字體?

RichTextBox1.SelectionFont?=?New?Font("宋體",?9.0!,?FontStyle.Bold)?'9號加粗宋體

換回原來的字體;

RichTextBox1.SelectionFont?=?OldFont?'設(shè)定回原來的字體

vb.net GDI ,不是系統(tǒng)的字體,是工程目錄下的字體文件

GDI繪圖用字體必須安裝才能使用

在客戶機部署應(yīng)用程序時,安裝該字體就行

VB.net使能不能內(nèi)嵌字體?

我們寫exe程序時,默認字體是宋體,比較難看,指定了其他字體,但是其他用戶上沒有你指定的這個字體的話,也會變成默認的宋體。解決的辦法有這么幾個:

1,叫用戶安裝相應(yīng)字體,這個基本不可能實現(xiàn),因為沒有幾個人會進行這樣的操作;

2,給用戶安裝相應(yīng)字體,這個辦法可行,在制作安裝包時將字體打包進去,然后用戶安裝程序的時候連字體也一并安裝上去,一勞永逸;

3,把字體導(dǎo)入到程序資源中,讓程序直接調(diào)用字體資源,缺點是導(dǎo)致程序體積巨大;

4,將字體文件放到程序目錄里,在程序里單獨調(diào)用。

個人覺得第4種辦法比較方便,所以決定采用這種方法,把代碼寫出來給需要的同學(xué)。

引用:

Imports System.Drawing.Text

public sub Setfont()

dim AppPath as string = Application.StartupPath

try

dim font1 as PrivateFontCollection = new PrivateFontCollection()

font1.AddFontFile(AppPath + "\font\msyh.ttf") '字體的路徑及名字

dim myFont as Font = new Font(font.Families[0].Name, 9,FontStyle.Regular,GraphicsUnit.Point, 134)

'設(shè)置窗體控件字體,哪些控件要更改都寫到下面

label1.Font = myFont

label2.Font = myFont

label3.Font = myFont

button1.Font = myFont

button2.Font = myFont

button3.Font = myFont

button4.Font = myFont

button5.Font = myFont

catch e as exception

MessageBox.Show("字體不存在或加載失敗\n程序?qū)⒁阅J字體顯示", "警告",

MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

end try

然后在public sub Form1()

InitializeComponent()

Setfont() '啟動字體設(shè)置函數(shù)

end sub

VB.NET 數(shù)值怎么轉(zhuǎn)換為字體

可以使用GetItemText

方法:返回指定項的文本表示形式。使用形式如下:

GetItemText(item)

vb.net如何檢查系統(tǒng)版本和系統(tǒng)里是否裝有微軟雅黑字體??

Private?Sub?Form_Load()

r=Dir(C:\WINDOWS\Fonts\微軟雅黑.ttf)?‘在C盤WINDOWS文件夾fonts中查找微軟雅黑

If?r""then

...(...填入)確認文件存在

Else

...(...填入)確認文件不存在

End?if

End?Sub

(*高分尋求*)有關(guān)vb.net的字體設(shè)置的小小問題。多多指教!先謝謝啦?。?/h2>

'新建一個VB.NET 項目,把原來所有代碼刪了,把下面的代碼復(fù)制貼上去解OK了

Public Class Form1

Inherits System.Windows.Forms.Form

#Region " Windows 窗體設(shè)計器生成的代碼 "

Public Sub New()

MyBase.New()

'該調(diào)用是 Windows 窗體設(shè)計器所必需的。

InitializeComponent()

'在 InitializeComponent() 調(diào)用之后添加任何初始化

End Sub

'窗體重寫 dispose 以清理組件列表。

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Windows 窗體設(shè)計器所必需的

Private components As System.ComponentModel.IContainer

'注意: 以下過程是 Windows 窗體設(shè)計器所必需的

'可以使用 Windows 窗體設(shè)計器修改此過程。

'不要使用代碼編輯器修改它。

Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton

Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton

Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox

Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox

Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton

Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton

Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox

Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox

Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox

Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

Friend WithEvents Button1 As System.Windows.Forms.Button

System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()

Me.RadioButton1 = New System.Windows.Forms.RadioButton

Me.RadioButton2 = New System.Windows.Forms.RadioButton

Me.GroupBox1 = New System.Windows.Forms.GroupBox

Me.GroupBox2 = New System.Windows.Forms.GroupBox

Me.RadioButton3 = New System.Windows.Forms.RadioButton

Me.RadioButton4 = New System.Windows.Forms.RadioButton

Me.CheckBox1 = New System.Windows.Forms.CheckBox

Me.CheckBox2 = New System.Windows.Forms.CheckBox

Me.CheckBox3 = New System.Windows.Forms.CheckBox

Me.TextBox1 = New System.Windows.Forms.TextBox

Me.Button1 = New System.Windows.Forms.Button

Me.GroupBox1.SuspendLayout()

Me.GroupBox2.SuspendLayout()

Me.SuspendLayout()

'

'RadioButton1

'

Me.RadioButton1.Location = New System.Drawing.Point(16, 24)

Me.RadioButton1.Name = "RadioButton1"

Me.RadioButton1.Size = New System.Drawing.Size(56, 24)

Me.RadioButton1.TabIndex = 1

Me.RadioButton1.Text = "紅色"

'

'RadioButton2

'

Me.RadioButton2.Location = New System.Drawing.Point(72, 24)

Me.RadioButton2.Name = "RadioButton2"

Me.RadioButton2.Size = New System.Drawing.Size(48, 24)

Me.RadioButton2.TabIndex = 2

Me.RadioButton2.Text = "藍色"

'

'GroupBox1

'

Me.GroupBox1.Controls.Add(Me.RadioButton2)

Me.GroupBox1.Controls.Add(Me.RadioButton1)

Me.GroupBox1.Location = New System.Drawing.Point(16, 144)

Me.GroupBox1.Name = "GroupBox1"

Me.GroupBox1.Size = New System.Drawing.Size(128, 56)

Me.GroupBox1.TabIndex = 5

Me.GroupBox1.TabStop = False

Me.GroupBox1.Text = "顏色"

'

'GroupBox2

'

Me.GroupBox2.Controls.Add(Me.RadioButton3)

Me.GroupBox2.Controls.Add(Me.RadioButton4)

Me.GroupBox2.Location = New System.Drawing.Point(176, 144)

Me.GroupBox2.Name = "GroupBox2"

Me.GroupBox2.Size = New System.Drawing.Size(136, 56)

Me.GroupBox2.TabIndex = 6

Me.GroupBox2.TabStop = False

Me.GroupBox2.Text = "字號"

'

'RadioButton3

'

Me.RadioButton3.Location = New System.Drawing.Point(16, 24)

Me.RadioButton3.Name = "RadioButton3"

Me.RadioButton3.Size = New System.Drawing.Size(56, 24)

Me.RadioButton3.TabIndex = 2

Me.RadioButton3.Text = "30號"

'

'RadioButton4

'

Me.RadioButton4.Location = New System.Drawing.Point(72, 24)

Me.RadioButton4.Name = "RadioButton4"

Me.RadioButton4.Size = New System.Drawing.Size(48, 24)

Me.RadioButton4.TabIndex = 1

Me.RadioButton4.Text = "40號"

'

'CheckBox1

'

Me.CheckBox1.Location = New System.Drawing.Point(32, 208)

Me.CheckBox1.Name = "CheckBox1"

Me.CheckBox1.Size = New System.Drawing.Size(80, 32)

Me.CheckBox1.TabIndex = 7

Me.CheckBox1.Text = "加粗"

'

'CheckBox2

'

Me.CheckBox2.Location = New System.Drawing.Point(120, 208)

Me.CheckBox2.Name = "CheckBox2"

Me.CheckBox2.Size = New System.Drawing.Size(80, 32)

Me.CheckBox2.TabIndex = 8

Me.CheckBox2.Text = "斜體"

'

'CheckBox3

'

Me.CheckBox3.Location = New System.Drawing.Point(200, 208)

Me.CheckBox3.Name = "CheckBox3"

Me.CheckBox3.Size = New System.Drawing.Size(80, 32)

Me.CheckBox3.TabIndex = 9

Me.CheckBox3.Text = "下劃線"

'

'TextBox1

'

Me.TextBox1.Font = New System.Drawing.Font("宋體", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))

Me.TextBox1.Location = New System.Drawing.Point(8, 16)

Me.TextBox1.Multiline = True

Me.TextBox1.Name = "TextBox1"

Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical

Me.TextBox1.Size = New System.Drawing.Size(320, 112)

Me.TextBox1.TabIndex = 0

Me.TextBox1.Text = "話說天下大勢,分久必合,合久必分。"

'

'Button1

'

Me.Button1.Location = New System.Drawing.Point(88, 256)

Me.Button1.Name = "Button1"

Me.Button1.Size = New System.Drawing.Size(152, 32)

Me.Button1.TabIndex = 10

Me.Button1.Text = "確定"

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)

Me.ClientSize = New System.Drawing.Size(336, 310)

Me.Controls.Add(Me.Button1)

Me.Controls.Add(Me.CheckBox3)

Me.Controls.Add(Me.CheckBox2)

Me.Controls.Add(Me.CheckBox1)

Me.Controls.Add(Me.GroupBox2)

Me.Controls.Add(Me.GroupBox1)

Me.Controls.Add(Me.TextBox1)

Me.Name = "Form1"

Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

Me.Text = "Form1"

Me.GroupBox1.ResumeLayout(False)

Me.GroupBox2.ResumeLayout(False)

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If Me.RadioButton1.Checked = True Then Me.TextBox1.ForeColor = System.Drawing.Color.Red

If Me.RadioButton2.Checked = True Then Me.TextBox1.ForeColor = System.Drawing.Color.Blue

If Me.RadioButton3.Checked = True Then Me.TextBox1.Font = New Font("宋體", 30)

If Me.RadioButton4.Checked = True Then Me.TextBox1.Font = New Font("宋體", 40)

Dim style As FontStyle = FontStyle.Regular

If Me.CheckBox1.Checked = True Then style = style Or FontStyle.Bold

If Me.CheckBox2.Checked = True Then style = style Or FontStyle.Italic

' If Me.CheckBox1.Checked = True And Me.CheckBox2.Checked = True Then TextBox1.Font = New Font(TextBox1.Font, FontStyle.Bold Or FontStyle.Italic)

If Me.CheckBox3.Checked = True Then style = style Or FontStyle.Underline

Me.TextBox1.Font = New Font(TextBox1.Font, style)

End Sub

End Class


本文標(biāo)題:vb.net安裝字體 vb中字體
標(biāo)題來源:http://weahome.cn/article/doccoii.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部