[Source] UnicoDetOGB, can convert Unicode strings to GB code for easy development.

xiaoxiao2021-03-06  60

Public class form1 inherits system.windows.Forms.form

#Region "Windows Form Designer Generated Code"

Public Sub new () mybase.new ()

'This call is required for the Windows Form Designer. InitializeComponent ()

'Add any initialization after INITIALIZECOMPONENT ()

End Sub

'Form rewriting Dispose to clean up the list of components. Protected overloads overrides sub dispose (byval disposing as boolean) ing disponation kiln (Components Is Nothing) Then components.dispose () end if endiffs) End sub

'Windows Form Designer Supply Private Components as System.comPonentModel.icontainer

'Note: The following procedure is necessary to use the Windows Form Designer to modify this process using the Windows Form Designer. 'Don't modify it using the code editor. Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Private Sub InitializeComponent () Me.TextBox1 = New System.Windows.Forms.TextBox Me. TextBox2 = New System.Windows.Forms.TextBox Me.SuspendLayout () '' TextBox1 'Me.TextBox1.Location = New System.Drawing.Point (7, 7) Me.TextBox1.Multiline = True Me.TextBox1.Name = " TextBox1 "Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.TextBox1.Size = New System.Drawing.Size (241, 121) Me.TextBox1.TabIndex = 0 Me.TextBox1.Text =" " ' 'TextBox2' Me.TextBox2.Location = New System.Drawing.Point (8, 136) Me.TextBox2.Multiline = True Me.TextBox2.Name = "TextBox2" Me.TextBox2.ScrollBars = System.Windows.Forms.ScrollBars. Vertical Me.TextBox2.size = new system.drawing.size (241, 112) Me.TextBox2.TabINDEX = 1 me.textbox2.text = "" 'FORM1' me.doscalebasesize = new system.drawing.size = new system.drawing.size (256, 255) Me.Controls.add (me.textbox2) me.controls.add (me.textbox1) me.name = "form1" me.text = "unicoidetogb" me.ResumeLayout (false) End Sub

#End region

Private sub textbox1_textchanged (Byval E AS System.EventArgs) Handles TextBox1.TextChangedend Sub

Private Sub TextBox1_KeyDown (ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.Escape Then TextBox2.Text = UnicodeToGB (TextBox1.Text) End If If e.KeyCode = Keys.f1 Then TextBox1.text = "" TextBox2.text = "" End if End Sub

Private Function UnicoDetogb (Byval Strunicode As String) AS String Dim Gbcode As String Dim I, J AS Integer Dim C () AS String 'Temporary Variable Redim C (Strunicode.length / 4)' 2 bytes One Chinese

For J = 0 to strunicode.Length / 4 - 1 DIM D () As char = Strunicode.ToChararray (j * 4, 4) c (j) = "& H" & ctype (d, string) c (j) = chrw (VAL (c (j))) GBCODE = C (j) 'Returns the last result back Return GBCode End Function

Private Sub Form1_Load (Byval E AS System.Object, Byval E AS System.Eventargs) Handles MyBase.Load

End Subend Class

转载请注明原文地址:https://www.9cbs.com/read-114238.html

New Post(0)