资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net代码高亮的简单介绍

VB.NET关键字上色/高亮问题。

Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged

创新互联建站网站建设服务商,为中小企业提供成都网站设计、成都网站制作服务,网站设计,网站托管等一站式综合服务型公司,专业打造企业形象网站,让您在众多竞争对手中脱颖而出创新互联建站

Dim pos = RichTextBox1.SelectionStart

Dim i As String = Regex.Matches(RichTextBox1.Text, "\bDim\b").ToString

RichTextBox1.SelectAll

RichTextBox1.SelectionColor = Color.Black

If Regex.IsMatch(RichTextBox1.Text, "\bDim\b") = True Then

For Each mat As Match In Regex.Matches(RichTextBox1.Text, "\bDim\b")

RichTextBox1.SelectionStart = mat.Index

RichTextBox1.SelectionLength = mat.Length

RichTextBox1.SelectionColor = Color.YellowGreen

Next

End If

RichTextBox1.SelectionStart = pos

RichTextBox1.SelectionLength = 0

End Sub

我做了一个更详细的正则:

Friend Keys As String =

"\b(#Const|#If|Then|#Else|#Region|Delegate|Namespace|Class|End|Firend|Partial|Module|Interface|Enum|Shared|Overrides|Overloads|Structure|Let|Const|Dim|As|Private|Public|New|Static|Option|Private|Module|IsArray|IsDate|IsEmpty|IsError|IsMissing|IsNull|IsNumeric|IsObject|TypeName|VarType|Me|Option|Explicit|Mod|Like|Is|Not|And|Or|Xor|Eqv|Imp|Clear|Error|Raise|Error|Err|CVErr|On|Error|Resume|IsError|Collection|Add|Remove|Item|DDB|SLN|SYD|FV|Rate|IRR|MIRR|NPer|IPmt|Pmt|PPmt|NPV|PV|Do|Loop|For|Next|For|Each|Next|While|Wend|With|Choose|If|Then|Else|Select|Case|Switch|Call|Function|Property|Get|Property|Let|Property|Set|Sub|Date|Now|Time|DateAdd|DateDiff|DatePart|DateSerial|DateValue|TimeSerial|TimeValue|Date|Time|Timer|CBool|CByte|CCur|CDate|CDbl|CDec|CInt|CLng|CSng|CStr|CVar|CVErr|Fix|Int|Boolean|Byte|Currency|Date|Double|Integer|Long|Object|Single|String|Object|Atn|Cos|Sin|Tan|Exp|Log|Sqr|Randomize|Rnd|Abs|Sgn|Fix|Int|IsArray|Array|Option|Base|Dim|Private|Public|ReDim|Static|LBound|UBound|Erase|ReDim|DeleteSetting|GetSetting|GetAllSettings|SaveSetting|Chr|Format|LCase|UCase|DateSerial|DateValue|Hex|Oct|Format|Str|CBool|CByte|CCur|CDate|CDbl|CDec|CInt|CLng|CSng|CStr|CVar|CVErr|Fix|Int|Day|Month|Weekday|Year|Hour|Minute|Second|Asc|Val|TimeSerial|TimeValue|StrComp|StrConv|Format|LCase|UCase|Space|String|Len|Format|LSet|RSet|InStr|Left|LTrim|Mid|Right|RTrim|Trim|Option|Compare|Asc|Chr|AppActivate|Shell|SendKeys|Beep|Command)\b"

vb.net listview控件怎样写代码,选择指定行,然后高亮!

'n为设置要选择的行,并高亮显示

ListView1.Items(n).Selected = True

ListView1.Focus()

vb.net 高亮度显示文本

选中就是高亮,首先得到你找到的文本字符的起始位置和长度,然后

TextBox.Select(start,length)

TextBox.SelectionStart = start

TextBox.SelectionLength = length


网站题目:vb.net代码高亮的简单介绍
网页URL:http://cdkjz.cn/article/doojgdd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220