下工具条的制作之六呢
----下面的例子中,窗口工具条内有两个分别代表打开文件和文件存盘的按钮,另外还有一个设置窗口客户区颜色的组合框。为免去烦琐地介绍工具条的设置过程,在窗体制作时仅仅加入一个toolbar控件和一个imagelist控件,另外在toolbar中加入一个组合框combobox。其它所有与toolbar的设置和控制有关的操作都在程序代码中实现,包括为imagelist1加入图片库、建立toolbar1和imagelist1的关联关系、在toolbar1中加入按钮并为每个按钮设置属性、对combo1进行初始化等等。
下面给出窗体form1的程序代码。 private sub form_load()
’ create object variable for the imagelist.
dim imgx as listimage
’ load pictures into the imagelist control.
set imgx = stimages. _
add(, \"open\", loadpicture(\"graphics\\bitmaps\\tlbr_w95\\p\"))
set imgx = stimages. _
add(, \"save\", loadpicture(\"graphics\\bitmaps\\tlbr_w95\\p\"))
agelist = imagelist1
’ create object variable for the toolbar.
dim btnx as button
’ add button objects to buttons collection using the
’ add method. after creating each button, set both
’ description and tooltiptext properties.
d , , , tbrseparator
set btnx = d(, \"open\", , tbrdefault, \"open\")
oltiptext = \"open file\"
scription = oltiptext
set btnx = d(, \"save\", , tbrdefault, \"save\")
oltiptext = \"save file\"
scription = oltiptext
set btnx = d(, , , tbrseparator)
’ the next button has the placeholder style. a
’ combobox control will be placed on top of this button.
set btnx = d(, \"combo1\", , tbrplaceholder)
dth = 1500 ’ placeholder width to accommodate a combobox.
show ’ show form to continue configuring combobox.
’ configure combobox control to be at same location as the
’ button object with the placeholder style (key = \"combo1\").
with combo1
.width = ttons(\"combo1\").width
.top = ttons(\"combo1\").top
.left = ttons(\"combo1\").left
.additem \"black\" ’ add colors for text.
.additem \"blue\"
.additem \"red\"
.listindex = 0
end with
end sub
private sub form_resize()
’ configure combobox control.
with combo1
.width = ttons(\"combo1\").width
.top = ttons(\"combo1\").top
.left = ttons(\"combo1\").left
end with
end sub
private sub toolbar1_buttonclick(byval button as button)
’ use the key property with the selectcase statement to specify
’ an action.
select case y
case is = \"open\" ’ open file.
msgbox \"add code to open file here!\"
case is = \"save\" ’ save file.
msgbox \"add code to save file here!\"
end select
end sub
private sub combo1_click()
’ change backcolor of form using the combobox.
select case stindex
case 0
ckcolor = vbblack
case 1
ckcolor = vbblue
case 2
联系到了吴女士。她说 ckcolor = vbred
end select
end sub
南昌男性功能障碍孩子不吃饭怎么办
石家庄治疗卵巢炎多少钱
-
给杜宾犬补钙时需要思考的问题位置
给狗狗补钙已经成为了很多主人们的心病,主人们也渐渐意识到给杜宾犬补钙的重要意义。主人们在饲养杜宾犬的...[详细]
-
罗威纳多少钱现在小罗威纳犬多少钱一只位置
导读:罗威纳犬优秀的护卫犬,也是十大猛犬中比较受欢迎的犬种,罗威纳犬威武雄伟,有着结实的身体,肌肉发...[详细]
-
能用沐浴露给狗洗澡吗可选宠物专用的位置
能用沐浴露给狗洗澡吗,我们人类洗澡会选用沐浴露,这样不仅可以很好的清洁皮肤上面的污垢,也可以起到保护...[详细]
-
苏格兰牧羊犬拉稀咳嗽如何是好位置
苏格兰牧羊犬最近有些咳嗽,还有点拉稀,可苏格兰牧羊犬体温正常,食欲很好,最近两天连续打针治疗,可是还...[详细]
-
观赏鱼波豆虫病的流行概况位置
>金鱼(详情介绍)观赏鱼波豆虫病又叫 病、口丝虫病,感染该病的观赏鱼皮肤上会出现一层乳白色或蓝灰色的粘液,...[详细]
-
鳄龟吃什么鳄龟饲料投喂需要注意的事项位置
鳄龟吃什么,乌龟的种类很多,今天我就认识一下鳄龟。说到鳄龟,我们不仅会问好不好养?鳄龟吃什么?鳄龟外表长...[详细]