我真的失去了控制這個小問題,無法糾正它?錯誤:屬性字體在Asp.Net中爲只讀
任何人都可以幫助我!
這裏是我的代碼:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim installed_fonts As New InstalledFontCollection
lstFont.Items.Clear()
For Each font_family As FontFamily In installed_fonts.Families
lstFont.Items.Add(font_family.Name)
Next font_family
lstFont.SelectedIndex = 0
End Sub
Private Sub txtSize_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSize.TextChanged, chkBold.Click, chkItalic.Click, chkUnderline.Click, chkStrikeout.Click, lstFont.SelectedIndexChanged
ShowSample()
End Sub
私人小組ShowSample()
' Compose the font style.
Dim font_style As FontStyle = FontStyle.Regular
If Bold.Checked Then font_style = font_style Or FontStyle.Bold
If Italic.Checked Then font_style = font_style Or FontStyle.Italic
If Underline.Checked Then font_style = font_style Or FontStyle.Underline
' Get the font size.
Dim font_size As Single = 8
Try
font_size = Single.Parse(DropFontSize.SelectedValue)
Catch ex As Exception
End Try
' Get the font family name.
Dim family_name As String = DropFont.SelectedIndex.ToString
If Not (DropFont.SelectedItem Is Nothing) Then
family_name = DropFont.SelectedItem.ToString
End If
' Make the new font.
Dim new_font As New Font(_
family_name, font_size, font_style)
' Set the sample's font.
TextBox1.Font.Name = new_font.Name
TextBox1.Font.Size = font_size
TextBox1.Font.Bold = Bold.Checked
TextBox1.Font.Italic = Italic.Checked
TextBox1.Font.Underline = Underline.Checked
末次
物業字體是隻讀的,我已經嘗試了許多片斷我得到擺脫這個問題,但沒有工作!
我在哪裏添加這個? – coder
@ user944919檢查我的更新 – Damith
雖然我已經更新了我的代碼,但它並未顯示任何區別。 – coder