If Check1.Value = 1 Then
Label1.FontBold = True
Else
Label1.FontBold = False
End If
End SubPrivate Sub Check2_Click()
If Check2.Value = 1 Then
Label1.FontItalic = True
Else
Label1.FontItalic = False
End If
End Sub Private Sub Check3_Click()
If Check3.Value = 1 Then
Label1.FontUnderline = True
Else
Label1.FontUnderline = False
End If
End SubPrivate Sub Command1_Click()
Timer1.Enabled = True
End SubPrivate Sub Option1_Click()
Option1.Value = True
Label1.Font = "宋体"
End SubPrivate Sub Option2_Click()
Option2.Value = True
Label1.Font = "黑体"
End SubPrivate Sub Option3_Click()
Option3.Value = True
Label1.Font = "楷体_GB2312"
End SubPrivate Sub Option4_Click()
Option4.Value = True
Label1.FontSize = 12
End SubPrivate Sub Option5_Click()
Option5.Value = True
Label1.FontSize = 18End SubPrivate Sub Option6_Click()
Option6.Value = True
Label1.FontSize = 22
End SubPrivate Sub Option7_Click()
Timer1.Enabled = True
Timer1.Interval = 1000
End SubPrivate Sub Option8_Click()
Timer1.Enabled = True
Timer1.Interval = 500
End SubPrivate Sub Option9_Click()
Timer1.Enabled = True
Timer1.Interval = 100End SubPrivate Sub Timer1_Timer()
If Label1.Left + Label1.Width >Form1.ScaleWidth Then
Label1.Left = Form1.ScaleLeft
Else
Label1.Move Label1.Left + 30
End If
End Sub这是实验第一部分的代码和界面设计。Option Explicit
Dim i As Integer, A(0 To 59) As IntegerPrivate Sub Command1_Click()
Dim k As Integer, j As Integer, b(0 To 59) As Integer
k = 0
For j = 0 To 59
If A(j) Mod 2 = 0 Then
b(k) = A(j)Text2.Text = Text2.Text &Str(b(k)) &Chr(9)
k = k + 1
End If
Next j
End SubPrivate Sub Form_Load()
i = 0
End SubPrivate Sub Timer1_Timer()
Dim n As Integer
If i >59 Then
Timer1.Enabled = False
Exit Sub
Else
n = Int(Rnd * 101 + 100)
Randomize
End If
If i Mod 10 = 0 Then
Text1.Text = Text1.Text + vbCrLf
End If
A(i) = n
Text1.Text = Text1.Text &Str(n) &Chr(9)
i = i + 1
End Sub这是实验第二部分代码和界面设计
vfp是一种解释性数据库编程语言,是由早期的dbase,经过foxbase,foxpro演变到目前的visual foxpro(可视化foxpro),早期的foxpro(或dbase,foxbase)都是在dos下运行的,界面不好看,但是很实用。VFP是基于windows下的可视化编程系统,界面友好,比在dos下编程更方便,仅仅编写几个简单的代码,往往就可以实现一般的需求。无论是dbase,还是foxbase,foxpro,或vfp,其基本、常用的命令很少,只要熟悉这几个命令就可以对数据库进行 *** 作,比如查看、修改、增加、删除。
制作好的vFP程序也可以编译成exe文件,更方便用户使用。
当然要想做一个比较合格的vfp编程人员,也需要下一番功夫才成。
class Card {// 0 - 3, 分别代表四种花色
int color
// 1-13,分别代表13张牌
int value
public Card(int index) {
value = index % 13 + 1
color = index / 13
}
}
/**
* 初始化52张牌
*/
public static void init() {
Card[] cs = new Card[52]
for (int i = 0i <52i++) {
cs[i] = new Card(i)
System.out.println(cs[i])
}
}
/**
* 随机发牌
*/
public static void ran() {
// 定义一个序列,每次从中提取一个元素
ArrayList<Integer>list = new ArrayList<Integer>()
for (int i = 0i <52i++)
list.add(i)
Card[] cs = new Card[52]
// 随机小于当前序列长度的数,从序列中提取一个
int max = 0
while (max <52) {
System.out.println(max)
Random r = new Random()
int ii = max <51 ? r.nextInt(51 - max): 0
cs[max] = new Card(list.get(ii))
list.remove(ii)
max++
}
for (Card c : cs)
System.out.println(c)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)