太晚了,想不出什么好方法了。
創(chuàng)新互聯(lián)是一家專注于網(wǎng)站設(shè)計、網(wǎng)站制作與策劃設(shè)計,陽朔網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:陽朔等地區(qū)。陽朔做網(wǎng)站價格咨詢:13518219792
發(fā)上來看看吧。
首先建立一個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
可以等等別人回答,看看有沒有更好的方法。
Dim?str?As?String?=?"",?temp,?n?As?Integer
Dim?str1?As?String?=?"12,45,2,9,41,31,66,83,2,1,-9,-91,-21"
Dim?a()?As?String?=?Split(str1,?",")
For?i?=?1?To?UBound(a)?Step?1
a(i)?=?Val(a(i))
Next
temp?=?0
n?=?0
For?i?=?1?To?UBound(a)
If?a(i)??temp?Then
temp?=?a(i)
End?If
If?a(i)??0?Then
n?=?n?+?1
End?If
Next
str?=?str??"正數(shù)的個數(shù)為?"??n
str?=?str??"最大元素的下標(biāo)為?"
For?i?=?1?To?UBound(a)
If?a(i)?=?temp?Then
str?=?str??i??"?"
End?If
Next
TextBox6.Text?=?str
改用富文本框(RichTextBox)控件或通過OLE的方式調(diào)用Word文檔對象。還有一種方法就是用webbowser控件調(diào)用html文檔來解決??傊苯釉谖谋究蛑惺菦]辦法輸入的。如果是簡單的符號,可以通過輸入法的軟鍵盤輸入
用 RichTextBox控件,(菜單 工程》部件》選 microsoft Rich Txtbox...) Private Sub Form_Load()
RichTextBox1.Font.Name = "Times New Roman"
RichTextBox1.Font.Size = 10
RichTextBox1.Text = "H2SO4"
'注釋: Move the numbers down 2 points.
OffsetRichText RichTextBox1, 2, 1, 2 ' 字串中第二個設(shè)為上標(biāo)
OffsetRichText RichTextBox1, 5, 1, -2 ' 字串中第5個設(shè)為下標(biāo)
End Sub'設(shè)置上下標(biāo)
Private Sub OffsetRichText(box As RichTextBox, start As Integer, length As Integer, offset As Integer)
'注釋:box指RichTextBox控件;start指作為上下標(biāo)的
'注釋:字符的起始位置;length指上下標(biāo)字符的長度;
'注釋:offset指上標(biāo)還是下標(biāo),大于0上標(biāo);小于0下標(biāo)。
box.SelStart = start - 1
box.SelLength = length
box.SelFontSize = box.Font.Size - Abs(offset)
box.SelCharOffset = ScaleY(offset, vbPoints, vbTwips)
box.SelStart = 0
box.SelLength = 0
End Sub
網(wǎng)頁題目:vbnet文本上下標(biāo) vb中下標(biāo)什么意思
標(biāo)題路徑:http://www.rwnh.cn/article38/dosijsp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)頁設(shè)計公司、網(wǎng)站設(shè)計、用戶體驗、面包屑導(dǎo)航、手機網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)