比較長(zhǎng) 不過支持全部的關(guān)鍵字 直接就可以用了 using System;using System Text;using System Text RegularExpressions;
創(chuàng)新互聯(lián)建站是專業(yè)的匯川網(wǎng)站建設(shè)公司,匯川接單;提供做網(wǎng)站、成都做網(wǎng)站,網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行匯川網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
namespace Com OSLeague Component{/// summary/// 語法分析器 將所有Code根據(jù)語法進(jìn)行變色/// list type= VB 支持VB NET/list/// list type= CS 支持CS/list/// author掉掉/author/// date 年 月 日鋒畝/date/// Memo/// 練習(xí)正則表達(dá)式/// /Memo/// /summarypublic class CodeAnalysis{
////定義HTML開始和結(jié)束的銀轎森語句 用于語法變色//
const string TAG_FNTRED = @ font color= red ;const string TAG_FNTBLUE = @ font color= blue ;const string TAG_FNTGRN = @ font color= green ;const string TAG_FNTMRN = @ font color= maroon ;const string TAG_FNTBLACK = @ font color= black ;const string TAG_EFONT = @ /font ;const string TAG_SPNYELLOW = @ span style= background color: yellow; ;const string TAG_ESPAN = @ /span ;const string TAG_B = @ b ;const string TAG_EB = @ /b ;const string TAG_MENT = @ font colr=# ;const string TAG_EMENT = @ /font ;
//
public CodeAnalysis(){//// TODO: 在此處添加構(gòu)造函數(shù)邏輯//}
/// summary/// 處理VB NET代碼 彩色化 /// /summary/// param name= Code 傳入的Code/param/// returns處理過后的代碼/returnspublic string ParseVB(string Code){////定義VB NET中關(guān)鍵字 將其存為帆慎數(shù)組//
string[] VB_Keyword = new string[]{ AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType Date Decimal Declare Default Delegate Dim DirectCast Do Double Each Else ElseIf End Enum Erase Error Event Exit False Finally For Friend Function Get GetType GoTo Handles If Implements Imports In Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing NotInheritable NotOverridable Object On Option Optional Or OrElse Overloads Overridable Overrides ParamArray Preserve Private Property Protected Public RaiseEvent ReadOnly ReDim RemoveHandler Resume Return Select Set Shadows Shared Short Single Static Step Stop String Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until Variant When While With WithEvents WriteOnly Xor };
////設(shè)定轉(zhuǎn)換代碼顏色//
lishixinzhi/Article/program/net/201311/14615
按照指定的完整路徑,循環(huán)搜索其中文件夾,搜索到一個(gè),就保存到字符串變量,搜索到新的覆蓋該變量賀絕,稿肢一直到循環(huán)結(jié)束,輸出禪敬姿該變量的值。
Public C護(hù)激篙刻蕻灸戈熏讓賀恭抹lass Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim c As Char
c = Trim(TextBox3.Text)
Select Case c
Case "察滑桐敗坦+"
TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Case "-"
TextBox4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
Case "*"
TextBox4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
Case "\"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母為0")
Else
TextBox4.Text = Val(TextBox1.Text) \ Val(TextBox2.Text)
End If
Case "/"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母為0")
Else
TextBox4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End If
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class