vb.net中的中断模式

时间:2017-09-14 13:28:40

标签: vb.net

enter image description here

我尝试从资源中应用字体,但是当我启动程序时,Visual Studio将进入中断模式。

Imports System.Drawing.Text

Dim customfont As PrivateFontCollection = New PrivateFontCollection
My.Computer.FileSystem.WriteAllBytes(Application.StartupPath + "\Font.ttf", My.Resources.kenvector_future_thin, True)
customfont.AddFontFile(Application.StartupPath + "\Font.ttf")
Button1.Font = New Font(customfont.Families(0), 20)
RadioButton1.Font = New Font(customfont.Families(0), 14)
RadioButton2.Font = New Font(customfont.Families(0), 14)
RadioButton3.Font = New Font(customfont.Families(0), 14)
RadioButton4.Font = New Font(customfont.Families(0), 14)
RadioButton5.Font = New Font(customfont.Families(0), 14)
Label1.Font = New Font(customfont.Families(0), 12)
GroupBox1.Font = New Font(customfont.Families(0), 14)
GroupBox2.Font = New Font(customfont.Families(0), 14)
Button1.Cursor = New Cursor(ms)

1 个答案:

答案 0 :(得分:0)

仔细检查您的路径:Application.StartupPath 确保Visual Studio可以访问该文件并且该文件存在。 您的错误告诉您您有AccessViolationException。右键单击要在Vb.Net中使用的文件,并在文件属性中检查它没有与之关联的权限。