绿色风's Blog
专注AutoIT(Au3)
  • 首页
  • 流●年
  • 笔●记
    • 学习随记
    • 源码示例
  • 脚●本
    • UDF(收集)
    • 工作室UDF
    • 工具●教程
    • 教程之GDI
  • 作●品
  • 下●载
  • 情怀ExcelTip
11月302014

GUI按键控件图标+文字

作者:绿色风   发布:2014-11-30 3:14 Sunday   分类:   阅读:5720次   评论:0条  

 

QQ截图20141130111138.png

#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```

 

 

 

原文地址:    >>传送<<





本文固定链接: http://www.jianyiit.com/post-34.html

blogger
该日志由 绿色风 于2014-11-30 3:14 Sunday发表在 分类下。
版权所有:《绿色风's Blog》 → 《GUI按键控件图标+文字》;
除特别标注,本博客很多文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:

扫描二维码,在手机上阅读
上一篇::[教程] 第一讲 GDI文字textout
下一篇:Au3-API教程

热门文章

相关文章

  • GUI按键控件图标+文字
  • 精典小巧的Url转码
  • user32.dll 说明
  • Au3 的时间戳
  • Windows消息代码
取消回复

发表评论

亲,头像对么?

94 + 10 =

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


    站点统计
    • 运行时间: 20254 天
    • 日志总数: 365 篇
    • 评论数量: 7237 条
    • 微语数量: 6 条
    • 附件总量: 388 件
  • 逝出的青春

  • 打赏"绿色风"



      扫码关注本站公众号 可搜本站内容

  • Autoit V3 脚本交流群

      常驻群1:905774875
      常驻群2:40672266


  • 链接

    • AU3中文论坛
    • Excel资料库
    • 完美者博客
    • 顺网小哥'S Blog
    • 猛牛哥的博客
    • 网吧系统下载
  • 分类

    • 流●年(66)
    • 笔●记(0)
    • 脚●本(0)
    • 作品(21)
    • 学习随记(51)
    • 源码示例(68)
    • UDF(收集)(26)
    • 工作室UDF(30)
    • 工具●教程(62)
    • 教程之GDI(24)
Copyright © 2013 绿色风's Blog. Powered by emlog. Theme by 射雕天龙. 鄂ICP备2021011689号-1 鄂公网安备42102302000078号 sitemap