vb.net字体上标 vb中字形代码

VB.NET文本框中的文本格式进行相应的设置

太晚了,想不出什么好方法了。

河东网站建设公司成都创新互联,河东网站设计制作,有大型网站制作公司丰富经验。已为河东上千余家提供企业网站建设服务。企业网站搭建\成都外贸网站建设公司要多少钱,请找那个售后服务好的河东做网站的公司定做!

发上来看看吧。

首先建立一个TextBox,我这里名字为TextBox2

然后放一个groupbox,在里头放两个Checkbox,checkbox1为粗体,checkbox2为斜体。

代码:

Dim Bold As Boolean

Dim Italic As Boolean

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

If CheckBox1.Checked Then

Bold = True

If Italic Then

TextBox2.Font = New Font(TextBox2.Font, FontStyle.Bold Or FontStyle.Italic)

Else

TextBox2.Font = New Font(TextBox2.Font, FontStyle.Bold)

End If

Else

Bold = False

If Italic Then

TextBox2.Font = New Font(TextBox2.Font, FontStyle.Italic)

Else

TextBox2.Font = New Font(TextBox2.Font, 0)

End If

End If

End Sub

Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged

If CheckBox2.Checked Then

Italic = True

If Bold Then

TextBox2.Font = New Font(TextBox2.Font, FontStyle.Italic Or FontStyle.Bold)

Else

TextBox2.Font = New Font(TextBox2.Font, FontStyle.Italic)

End If

Else

Italic = False

If Bold Then

TextBox2.Font = New Font(TextBox2.Font, FontStyle.Bold)

Else

TextBox2.Font = New Font(TextBox2.Font, 0)

End If

End If

End Sub

可以等等别人回答,看看有没有更好的方法。

vb.net列表显示图标 文字前面一个图标

Public Class Form1

Private Imgfile As String

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

ListBox1.DrawMode = DrawMode.OwnerDrawVariable

Imgfile = "X:\Users\......\Pictures\ssm.png"‘显示为listbox的每一行文字前面的图标文件,换一张你自己的图片。

End Sub

Private Sub ListBox1_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ListBox1.DrawItem

e.DrawBackground()

Dim rect As Rectangle = New Rectangle(2, e.Bounds.Y + 2, e.Bounds.Height, e.Bounds.Height - 4)

e.Graphics.DrawImage(New Bitmap(Imgfile), rect)

e.Graphics.DrawString(sender.Items(e.Index), sender.Font, New SolidBrush(sender.ForeColor), _

New RectangleF(e.Bounds.X + rect.Width, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))

e.DrawFocusRectangle()

End Sub

End Class

vb.net 字体如何设置?(font,fontfamily)

可以利用font 设置。设置方法如下:

TextBox1.Font = New System.Drawing.Font("宋体", 10)

也可以通过字体对话框来实现 如:

Private Sub myButton_Click(sender As Object, e As EventArgs)

Dim myFontDialog As FontDialog

myFontDialog = New FontDialog()

If myFontDialog.ShowDialog() = DialogResult.OK Then

' Set the control's font.

myDateTimePicker.Font = myFontDialog.Font

End If

End Sub

vb.net中,如何用代码设置字体及字号?不要弹对话框的那种

Me.RichTextBox1.SelectionFont = New Font("宋体", 14.25!, FontStyle.Bold Or FontStyle.Italic)

怎么在VB.NET的标题栏上添加控间啊,或是怎么改变标题栏字体的颜色?

标题栏不能修改,但可以隐藏,自己绘制最大化、最小化、关闭按钮和代码,还有无边框移动窗体、改变窗体大小的代码。

也可以用api,百度应该能找到。

本文题目:vb.net字体上标 vb中字形代码
标题链接:https://www.cdcxhl.com/article30/dodhdso.html

成都网站建设公司_创新互联,为您提供网站导航网站设计公司商城网站标签优化定制网站网站制作

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设公司