首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

VB下角标有关问题,请高手帮帮小弟我,多谢您

2012-01-16 
VB下角标问题,请高手帮帮我,谢谢您我之前问过,怎样才能搞出来下角标,有人告诉我用富文本框,然后给我这个例

VB下角标问题,请高手帮帮我,谢谢您

 我之前问过,怎样才能搞出来下角标,有人告诉我用富文本框,然后给我这个例子
 

VB code
Private   Sub   Command1_Click()     RichTextBox1.Font.Name   =   "Times   New   Roman"     RichTextBox1.Font.Size   =   20     RichTextBox1.Text   =   "X3Y4"     OffsetRichText   RichTextBox1,   3,   1,   -6    End   Sub     Private   Sub   OffsetRichText(box   As   RichTextBox,   start   As   Integer,   length   As   Integer,   offset   As   Integer)     box.SelStart   =   start     box.SelLength   =   length     box.SelFontSize   =   box.Font.Size   -   Abs(offset)     box.SelCharOffset   =   ScaleY(offset,   vbPoints,   vbTwips)     box.SelStart   =   0     box.SelLength   =   0     End   Sub 

 这些都是什么意思,帮我解释一下吧。我如果需要X2Y3(2和3是下角标)应该怎么改呢?谢谢您
谢谢您的帮助,我傍晚回来看


[解决办法]
VB code
Option ExplicitPrivate Sub Command1_Click()  RichTextBox1.Font.Name = "Times   New   Roman" '字体为Times   New   Roman  RichTextBox1.Font.Size = 20 '字号为20  RichTextBox1.Text = "X3Y4" '字串为X3Y4  OffsetRichText RichTextBox1, 3, 1, -6 '调用 OffsetRichText过程生成下标,第一个参数为RichTextBox1,第二个参数表示从第四个字符开始,第三个参数表示只作用于1个字符,第四参数是下移量(缇)  End Sub  Private Sub OffsetRichText(box As RichTextBox, start As Integer, length As Integer, offset As Integer)  box.SelStart = start '生成下标(选中)字符的开始位置  box.SelLength = length '生成下标(选中)字符的长度  box.SelFontSize = box.Font.Size - Abs(offset) '生成下(选中)字符的字号  box.SelCharOffset = ScaleY(offset, vbPoints, vbTwips) '把偏移量由磅转为缇  box.SelStart = 0  box.SelLength = 0  End Sub
[解决办法]
探讨
这些都是什么意思,帮我解释一下吧。我如果需要X2Y3(2和3是下角标)应该怎么改呢?谢谢您

热点排行