效果图:
1、创建Standard Visual标准系统控件,选择singlelineedit控件,命名为uo_contenthint
2、复制下面代码,替换uo_contenthint对象的Edit Source中的语法
forward
global type uo_contenthint from singlelineedit
end type
end forward
global type uo_contenthint from singlelineedit
integer width = 457
integer height = 128
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type
global uo_contenthint uo_contenthint
type variables
string is_con='' //存储提示内容
boolean ibb_bool=true //判断是否是输入内容还是提示内容
//il_color 输入文字内容颜色 , il_color_2 提示内容文字颜色
long il_color=33554432,il_color_2=3234324
end variables
forward prototypes
public subroutine uo_initial (string as_msg)
end prototypes
public subroutine uo_initial (string as_msg);this.text=as_msg
is_con=as_msg
this.textcolor=il_color_2
end subroutine
on uo_contenthint.create
end on
on uo_contenthint.destroy
end on
event getfocus;if ibb_bool then
this.text=''
this.textcolor=il_color
end if
end event
event losefocus;if ibb_bool then
this.text=is_con
this.textcolor=il_color_2
end if
end event
event modified;if trim(this.text)='' then
ibb_bool=true
else
ibb_bool=false
end if
end event
1、获取输入的内容
if sle_3.ibb_bool then
else
messagebox("",sle_3.text)
end if