设一个窗体变量,记录下最近一次获取焦点的textbox
Option ExplicitPrivate ntext As Integer
Private Sub Command1_Click()
If ntext = 1 Then
Text1Text = Command1Caption
ElseIf ntext = 2 Then
Text2Text = Command1Caption
End If
End Sub
Private Sub Command2_Click()
If ntext = 1 Then
Text1Text = Command2Caption
ElseIf ntext = 2 Then
Text2Text = Command2Caption
End If
End Sub
Private Sub Text1_GotFocus()
ntext = 1
End Sub
Private Sub Text2_GotFocus()
ntext = 2
End Sub'根据你的界面和要求,我写了段代码,复制上去就行了!
Private Sub Command1_Click()
If Option1Value = True Then
Text1FontName = "宋体"
ElseIf Option2Value = True Then
Text1FontName = "隶书"
ElseIf Option3Value = True Then
Text1FontName = "黑体"
End If
If Option4Value = True Then
Text1FontSize = 16 '三号
ElseIf Option5Value = True Then
Text1FontSize = 14 '四号
ElseIf Option6Value = True Then
Text1FontSize = 105 '五号
End If
'用中文的话比较麻烦的,上面我都标出来了,再给你个参数
'八号=5,七号=55,小六=65,六号=75,小五=9,五号=105,小四=12,四号=14,三号=16,小二=18,二号=22,小一=24,一号=26,小初=36
End Subsub command1_click()
static flag as boolean
flag = not flag
text1text = iif(flag,"11","22")
end subPrivate Sub Command1_Click()
Label1Caption = "开始变色咯" '改变标签文字
Label1ForeColor = rgb(rnd255,rnd255,rnd255) '随机变色
End Sub1、先在一个窗体Form1画一个command控件,form1中的代码编写如下:2、按如下图所示设置窗体1的属性3、将如下的代码复制进去,注意需要删除多余的地方
Private
Sub
Command1_Click()
MsgBox
"老婆来亲一个(~o~)~zZ",
vbInformation
MeHide
Form2Show
End
SubPrivate
Sub
Form_Load()
Form1Caption
=
"献给我亲爱的老婆"
End
Sub
4、通过工程-添加窗体,在窗体1上增加个窗体2(Form2),form2上画两个按钮command1、Command2,按如上图同样方法设置窗体属性外,另外还需要设置窗体2的如下属性:5、复制如下代码放在窗体2中Private
Sub
Command1_Click()
MsgBox
"你的嘴巴好甜哦,下次再亲我哦~",
vbExclamation,
"老婆我爱你"
Unload
Me
Unload
Form1
End
SubPrivate
Sub
Command2_Click()
MsgBox
"不亲不行哦",
vbCritical,
"亲不亲?"
End
SubPrivate
Sub
Form_Load()
Command1Caption
=
"亲一个"
Command2Caption
=
"不亲"
Form2Caption
=
"亲亲我"
MeBorderStyle
=
0
End
Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)