让VB在图片指定位置加入文字
1个回答
展开全部
VB6.0中使用函数功能,可实现在vb的picture图中写文字,且字号及字体颜色可按要求改变,代码如下:
Option
Explicit
Dim
xx,
yy
As
Integer
Dim
fnt
As
Long
Dim
txt
As
String
Dim
colvb
As
String
Dim
wp
As
Variant
Public
Function
xp(colvb
As
Variant,
xx
As
Variant,
yy
As
Variant,
fnt
As
Variant,
txt
As
Variant)
Picture1.ForeColor
=
colvb
'QBColor(14)
Picture1.CurrentX
=
xx
Picture1.CurrentY
=
yy
Picture1.FontSize
=
fnt
Picture1.Print
txt
'
End
Function
Private
Sub
Form_Load()
Picture1.AutoRedraw
=
True
xx
=
500
yy
=
500
fnt
=
24
colvb
=
vbRed
txt
=
"这是VB对PICTURE图片框的图片上写字的演示"
wp
=
xp(colvb,
xx,
yy,
fnt,
txt)
xx
=
500
yy
=
2500
fnt
=
48
colvb
=
vbGreen
txt
=
"字号调大的演示"
wp
=
xp(colvb,
xx,
yy,
fnt,
txt)
End
Sub
Option
Explicit
Dim
xx,
yy
As
Integer
Dim
fnt
As
Long
Dim
txt
As
String
Dim
colvb
As
String
Dim
wp
As
Variant
Public
Function
xp(colvb
As
Variant,
xx
As
Variant,
yy
As
Variant,
fnt
As
Variant,
txt
As
Variant)
Picture1.ForeColor
=
colvb
'QBColor(14)
Picture1.CurrentX
=
xx
Picture1.CurrentY
=
yy
Picture1.FontSize
=
fnt
Picture1.Print
txt
'
End
Function
Private
Sub
Form_Load()
Picture1.AutoRedraw
=
True
xx
=
500
yy
=
500
fnt
=
24
colvb
=
vbRed
txt
=
"这是VB对PICTURE图片框的图片上写字的演示"
wp
=
xp(colvb,
xx,
yy,
fnt,
txt)
xx
=
500
yy
=
2500
fnt
=
48
colvb
=
vbGreen
txt
=
"字号调大的演示"
wp
=
xp(colvb,
xx,
yy,
fnt,
txt)
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询