zhongzijie 发表于 2011-2-13 23:24:08

[已解決]状态栏显示文字长度的问题,麻烦知道的朋友指定一下,谢谢

本帖最后由 zhongzijie 于 2011-2-14 20:26 编辑

;代码A能完全显示出文字
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)
Local $hGUI, $hProgress, $hButton, $Button, $progress, $hStatus,$hStatus2,$Msgbox
Local $aParts = [-1];定义状态栏
$hGUI = GUICreate("为什么状态栏有些显示不够很长啊", 1200, 30)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
GUISetState()
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
;_GUICtrlStatusBar_SetText ($hStatus, @TAB&"看见我:[看见我看见我]看见我:看见我:看见我:看见我:看见我:看见我:看见我:看见我:", 0)
_GUICtrlStatusBar_SetText ($hStatus, @TAB&"[开始]看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我[结束]", 0)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

While 1
$Msgbox=GUIGetMsg()
Switch $Msgbox
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSwitch
WEnd

;代码B不能完全显示出文字
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)
Local $hGUI, $hProgress, $hButton, $Button, $progress, $hStatus,$hStatus2,$Msgbox
Local $aParts = [-1];定义状态栏
$hGUI = GUICreate("为什么状态栏有些显示不够很长啊", 1200, 30)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
GUISetState()
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, @TAB&"看见我:[看见我看见我]看见我:看见我:看见我:看见我:看见我:看见我:看见我:看见我:", 0)
;_GUICtrlStatusBar_SetText ($hStatus, @TAB&"[开始]看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我看见我[结束]", 0)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

While 1
$Msgbox=GUIGetMsg()
Switch $Msgbox
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSwitch
WEnd

水木子 发表于 2011-2-14 00:20:34

没明白楼主的意思,我测试了下你的代码,显示是正常的吧!

zhongzijie 发表于 2011-2-14 00:32:15

这个是代码A
http://www.53taobao.com/y/05d700568c0c1da7b62a581293ef6157.jpg
这个是代码B
http://www.53taobao.com/y/1086d0f349c373f840d498cefeb6840d.jpg

3mile 发表于 2011-2-14 16:50:56

回复 3# zhongzijie
lParam
    Pointer to a null-terminated string that specifies the text to set. If wParam is SBT_OWNERDRAW, this parameter represents 32 bits of data. The parent window must interpret the data and draw the text when it receives the WM_DRAWITEM message. In Windows XP and earlier, the text for each part is limited to 127 characters. This limitation has been removed in Windows Vista.
大意:在Windows XP和更早版本,每个部分文字被限制为127个字符。Vista无此限制。
传送门:http://msdn.microsoft.com/en-us/library/bb760758%28v=vs.85%29.aspx

水木子 发表于 2011-2-14 16:57:34

回复 4# 3mile

原来如此,我昨天是Win7,所以没发现楼主描述的问题。

zhongzijie 发表于 2011-2-14 20:25:47

謝謝3mile 解答和謝謝水木子 的關注,我找到笨辦法了,把內容分幾個狀態就好了{:face (301):}
页: [1]
查看完整版本: [已解決]状态栏显示文字长度的问题,麻烦知道的朋友指定一下,谢谢