找回密码
 加入
搜索
查看: 4359|回复: 8

[GUI管理] gui界面中 tab 控件如何把 图片设置到上面

  [复制链接]
发表于 2010-3-31 15:18:34 | 显示全部楼层 |阅读模式
$Tab1 = GUICtrlCreateTab(8, 80, 473, 513)
$TabSheet1 = GUICtrlCreateTabItem(" 哈哈")
_GUICtrlTab_SetItemImage($Tab1, 0, 1)

这样有 tab 加载图标 默认是显示在 文字的左边

我想设置到 文字的上面 如何 扩张样式呢

评分

参与人数 1金钱 +10 收起 理由
howie530_8 + 10 GUICtrlCreateTabItem这个函数代码怎么不加 ...

查看全部评分

 楼主| 发表于 2010-4-2 01:20:13 | 显示全部楼层
......................

评分

参与人数 1金钱 -10 收起 理由
afan -10 恶意灌水,扣分警告!

查看全部评分

发表于 2010-4-2 13:03:18 | 显示全部楼层
只好想其它办法了。
发表于 2010-4-2 13:32:28 | 显示全部楼层
本帖最后由 水木子 于 2010-4-2 14:00 编辑

标签控件倒是没有试过,不过咱这儿有个例子,楼主不妨看看,希望能有启发。
#include <GuiButton.au3>
#include <GuiImageList.au3>

GUICreate("设置按钮图标", 560, 100)
$But1 = GUICtrlCreateButton("图标靠左", 10, 20, 100, 60, $BS_FLAT)
_SetIcon(-1, 'shell32.dll', 22, 0, 20, 20)

$But2 = GUICtrlCreateButton("图标靠右", 120, 20, 100, 60, $BS_FLAT)
_SetIcon(-1, 'shell32.dll', 23, 1)

$But3 = GUICtrlCreateButton("图标靠上", 230, 20, 100, 60, $BS_FLAT)
_SetIcon(-1, 'shell32.dll', 24, 2, 30, 30)

$But4 = GUICtrlCreateButton("图标靠下", 340, 20, 100, 60, $BS_FLAT)
_SetIcon(-1, 'shell32.dll', 25, 3, 35, 35)

$But5 = GUICtrlCreateButton("图标居中", 450, 20, 100, 60, $BS_FLAT)
_SetIcon(-1, 'shell32.dll', 26, 4, 40, 40)
GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit

        EndSwitch
WEnd

Func _SetIcon($hWnd, $sFile, $iIndex = 0, $nAlign = 0, $iWidth = 25, $iHeight = 25) ;控件句柄, 图标图像的路径, 图标索引, 图标在控件中的位置, 图标宽度, 图标高度
        $hImage1 = _GUIImageList_Create($iWidth, $iHeight, 5, 1, 0) ;创建图像列表控件
        _GUIImageList_AddIcon($hImage1, $sFile, $iIndex, True) ;向图像列表添加图标
        _GUICtrlButton_SetImageList($hWnd, $hImage1, $nAlign) ;分配一个图像列表到按钮控件,$nAlign 是图标位置参数
EndFunc   ;==>_SetIcon
 楼主| 发表于 2010-4-5 19:55:23 | 显示全部楼层
_GUICtrlButton_SetImageList($hWnd, $hImage1, $nAlign)
他是靠  $nAlign 来设置  图标位置
而 _GUICtrlTab_SetImageList($hWnd, $hImage)
只有2个参数  不带位置的参数
我看过了
 楼主| 发表于 2010-4-5 19:55:43 | 显示全部楼层
不过还是谢谢你的跟贴
 楼主| 发表于 2010-4-5 19:58:12 | 显示全部楼层
_GUICtrlTab_SetItemImage($hWnd, $iIndex, $iImage)

同样不带位置参数
发表于 2010-4-5 20:01:15 | 显示全部楼层
标签横排的话设置图标到上面应该不好看吧,竖排的话可以看看GUICtrlCreateTab的样式
 楼主| 发表于 2010-4-7 01:12:46 | 显示全部楼层
谢谢
想图片在上 文字在下

干脆自己ps做个图片  包含文字

然后tab 显示图片 等同于的效果 就是文字在下
呵呵
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 06:23 , Processed in 0.081714 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表