网站首页 > 文章中心 > 其它

vb.net字号与数值

作者:小编 更新时间:2023-10-23 10:40:58 浏览量:309人看过

(*高分寻求*)有关vb.net的字体设置的小小问题.多多指教!先谢谢啦!!

'新建一个VB.NET 项目,把原来所有代码删了,把下面的代码复制贴上去解OK了

Public Class Form1

Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

vb.net字号与数值-图1

Public Sub New()

MyBase.New()

'该调用是 Windows 窗体设计器所必需的.

InitializeComponent()

'在 InitializeComponent() 调用之后添加任何初始化

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

MyBase.Dispose(disposing)

'Windows 窗体设计器所必需的

Private components As System.ComponentModel.IContainer

'注意: 以下过程是 Windows 窗体设计器所必需的

'可以使用 Windows 窗体设计器修改此过程.

Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton

Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox

Friend WithEvents CheckBox1 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.GroupBox1 = New System.Windows.Forms.GroupBox

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

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

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

Me.GroupBox1.SuspendLayout()

Me.SuspendLayout()

'

'RadioButton1

Me.RadioButton1.Name = "RadioButton1"

Me.RadioButton1.TabIndex = 1

Me.RadioButton1.Text = "红色"

'GroupBox1

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

Me.GroupBox1.Name = "GroupBox1"

Me.GroupBox1.TabStop = False

Me.GroupBox1.Text = "颜色"

'CheckBox1

Me.CheckBox1.Name = "CheckBox1"

Me.CheckBox1.Text = "加粗"

'TextBox1

Me.TextBox1.Multiline = True

Me.TextBox1.Name = "TextBox1"

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

Me.TextBox1.TabIndex = 0

Me.TextBox1.Text = "话说天下大势,分久必合,合久必分."

'Button1

Me.Button1.Name = "Button1"

Me.Button1.TabIndex = 10

Me.Button1.Text = "确定"

'Form1

Me.Controls.Add(Me.Button1)

Me.Controls.Add(Me.CheckBox1)

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.ResumeLayout(False)

#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

Dim style As FontStyle = FontStyle.Regular

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

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

End Class

VB.NET 数值怎么转换为字体

VB中的字符串和数值

以上就是土嘎嘎小编为大家整理的vb.net字号与数值相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章