【正文】
char char = End If Next i Call conver(data, char) Print char End Sub Private Sub conver(a() As String, ch As String) Dim i As Integer, j As Integer Dim n As Integer, dec As Integer For i = 1 To UBound(a) n = Len(a(i)) For j = 1 To n dec = dec + Val(Mid(a(i), j, 1) * 8 ^ (n j)) Next j ch = ch amp。 Chr(dec) dec = 0 Next i End Sub(2)static變量 Private Sub Command1_Click() Dim n As Integer, i As Integer n = 2 For i = 9 To 1 Step 1 Call sub2(i, n) Print i, n Next i End Sub Private Sub sub2(x As Integer, y As Integer) Static n As Integer Dim i As Integer For i = 3 To 1 Step 1 n = n + x x = x 1 Next i y = y + n End Sub (3) 遞歸 Private Sub Command1_Click() Dim a As Integer a = 2 Call sub1(a) End Sub Private Sub sub1(x As Integer) x = x * 2 + 1 If x 10 Then Call sub1(x) End If x = x * 2 + 1 Print x End Sub (4)遞歸 Private Sub test(x As Integer) Dim i As Integer If x 0 Then Call test(x 1) For i = 1 To x Print x?! ext i Print End If End Sub Private Sub Form_Click() test 3 End Sub (5)同名變量 Dim y As Integer Private Sub Form_Click() Dim x As Integer,y as integer x=1 : y=1 Print x1=。x, y1=。y Test Print x4=。x, y4=。y End Sub Private Sub Test() Dim x As Integer Print x2=。x, y2=。y x=2 : y=3 Print x3=。x,y3=。y End Sub 特例: 運(yùn)行程序在窗體顯示的結(jié)果是: Private Sub Form_Click() Dim a As Integer, b As Integer a = 3: b = 4 Call sub1(a, a) Print a, b Call sub1(b, b) Print a, b End Sub Private Sub sub1(x As Integer, y As Integer) x = x + 2 y = x + y End Sub運(yùn)行程序單擊窗體,在窗體上顯示的內(nèi)容是:16 20 Private Sub Form_Click() Dim n As Integer, m As Integer n = 1: m = 2 Print n + m + f(n, m) ?! ?9。優(yōu)先執(zhí)行f函數(shù),n,m變化后再運(yùn)算 “+” n = 2: m = 1 Print f(n, m) + f(m, n) 39。n,m第一次變化后,第二次以變化后的值再調(diào)用 End Sub Private Function f(n As Integer, m As Integer) n = n + m m = m + 3 f = n + m End Function 執(zhí)行下面的程序,在窗體上顯示的輸出結(jié)果是______。如果將A語句改成:Call sub1(b+1,a),則在窗體上顯示的輸出結(jié)果是______?! rivate Sub Form_Click() Dim a As Integer, b As Integer a = 1: b = 2 Call sub1(a, b) 39。A Print a, b End Sub Private Sub sub1(x As Integer, ByVal y As Integer) x = x + yy = x + yEnd Sub167。、文本、圖形及多媒體處理 (1)常用鼠標(biāo)方法(MouseDown, MouseUp,MouseMove) (2)數(shù)據(jù)輸出的格式化處理(Format函數(shù)) (3)圖形控件Line、Shape使用畫點(diǎn)(Pset)、線(Line)、圓(Circle) 例如:在Form_Click事件中執(zhí)行如下語句的正確結(jié)果是( )?! rint Format(,“+,%”) B.+123,% C.+123,% D.+123,654167。9數(shù)據(jù)庫 ?。骸 ∪斯す芾怼募芾怼獢?shù)據(jù)庫管理 ?。骸 哟文P?樹型結(jié)構(gòu))—網(wǎng)絡(luò)模型(無向圖形)—關(guān)系模型(二維關(guān)系表) (Data)的重要屬性: Conncet:確定數(shù)據(jù)訪問類型(Access(缺省值)\dbase\Foxpro) DatabaseName:確定數(shù)據(jù)控件使用的數(shù)據(jù)庫 Access表包含“.mdb”的文件中,該屬性值就是:.mdb dbase\Foxpro數(shù)據(jù)庫時(shí),該屬性值是:包含數(shù)據(jù)庫文件的路徑 RecordSource:確定訪問數(shù)據(jù)表的名稱 ?。簶?biāo)簽、文本框、檢查框、組合框、列表框、圖片框、圖象控件、DBCombo、Dblist、DBGrid 常用屬性: DataSource:指定一個(gè)數(shù)據(jù)控件(Data控件) DataField:指定顯示的數(shù)據(jù)表的哪一字段。