找回密码
 加入
搜索
查看: 3270|回复: 4

[AU3基础] [已解决]如何修改_GUICtrlListView_Create字体大小?谢谢!

[复制链接]
发表于 2013-1-15 13:21:41 | 显示全部楼层 |阅读模式
本帖最后由 webberliuwei 于 2013-1-15 14:20 编辑

使用_GUICtrlListView_Create而不是用GUICtrlCreateListView
建立一个listview后如何调整listview中的字体大小,请各位高手请教一下,非常感谢!

已解决,详见4楼......

例子如下,
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>
$gui = GUICreate("ListView Set BkColor", 400, 300)
$hListView = _GUICtrlListView_Create($gui, "", 2, 2, 394, 268)
GUISetState()
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN);修改背景颜色
_GUICtrlListView_SetTextColor($hListView, 0xffffff);修改字颜色
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN);修改字背景颜色
GUICtrlSetFont($hListView, 11, 800, 0, "宋体");这个语句只对 GUICtrlCreateListView生效?如何修改字体大小?

; 添加列
_GUICtrlListView_AddColumn($hListView, "Items", 100)
; 添加项目
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
        _GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; 显示颜色
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
发表于 2013-1-15 13:24:28 | 显示全部楼层
udf区找找修改listview单元格字体
 楼主| 发表于 2013-1-15 13:35:59 | 显示全部楼层
udf区找找修改listview单元格字体
netegg 发表于 2013-1-15 13:24

谢谢关注,之前搜了一下这个问题,貌似没有很好的答案.
这个UDF可以改背景,背景色,字体色,但是貌似没有语句改字的大小,默认的字体太小了,郁闷中....
能否给个简单的例子?thanks.
发表于 2013-1-15 14:09:05 | 显示全部楼层
本帖最后由 happytc 于 2013-1-15 14:11 编辑

回复 1# webberliuwei

GUICtrlSetFont是基于API函数 _WinAPI_CreateFont(),所以你需要自己调用它。
另外微软的Listview控件有个著名的bug,就是不能改变字段字的字体大小,若系统主题没有关掉的话

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>
#include <WinAPI.au3>
$hFont = _WinAPI_CreateFont(20, 10, 0, 0, $FW_NORMAL, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$gui = GUICreate("ListView Set BkColor", 400, 300)
$hListView = _GUICtrlListView_Create($gui, "", 2, 2, 400, 400)
GUISetState()
_WinAPI_SetFont($hListView, $hFont, True)
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN);修改背景颜色
_GUICtrlListView_SetTextColor($hListView, 0xffffff);修改字颜色
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN);修改字背景颜色
;~ GUICtrlSetFont($hListView, 11, 800, 0, "宋体");这个语句只对 GUICtrlCreateListView生效?如何修改字体大小?

; 添加列
_GUICtrlListView_AddColumn($hListView, "Items", 100)
; 添加项目
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
        _GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; 显示颜色
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

评分

参与人数 1金钱 +20 收起 理由
webberliuwei + 20 小小心意,请笑纳~

查看全部评分

 楼主| 发表于 2013-1-15 14:17:28 | 显示全部楼层
回复  webberliuwei

GUICtrlSetFont是基于API函数 _WinAPI_CreateFont(),所以你需要自己调用它。
另外 ...
happytc 发表于 2013-1-15 14:09

Very Cool~非常感谢~happytc!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-8 10:46 , Processed in 0.120838 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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