[已解决]关于状态栏(StatusBaru)的使用问题
本帖最后由 ssfnpyu 于 2010-9-2 10:21 编辑$_DengLu_StatusBar = _GUICtrlStatusBar_Create($Form_DengLu)
Dim $_DengLu_StatusBar_PartsWidth = [-1]
_GUICtrlStatusBar_SetParts($_DengLu_StatusBar, $_DengLu_StatusBar_PartsWidth)
_GUICtrlStatusBar_SetText($_DengLu_StatusBar, @TAB & "随便来点内容", 0)
这个状态栏能不能加上Case的
就是能不能像按钮控件一样可以点击它以后会弹出窗口等等操作的!! 可以试试控件嵌套,不过没试过 这个估计要用到系统消息了。
不过实现类似的功能倒是可以的,不过不推荐。
仅复制我自己写过的程序一段代码,请改了之再运行。
状态栏创建。Local $aParts = ,$hSeverInfo,$hConnetInfo
$ConnectStatus = _GUICtrlStatusBar_Create ($PPForm,$WS_EX_OVERLAPPEDWINDOW)
_GUICtrlStatusBar_SetMinHeight ($ConnectStatus, 20)
_GUICtrlStatusBar_SetParts ($ConnectStatus, $aParts)
_GUICtrlStatusBar_SetText($ConnectStatus,"离线",0)
$Message=$M_LogInNo
_GUICtrlStatusBar_SetText($ConnectStatus,$Message,1)
;----------
_GUICtrlStatusBar_SetText($ConnectStatus,"标准",2)
$hLibrary = _WinAPI_LoadLibrary("Shell32.dll")
$hCursor = _LoadCursor($hLibrary, 1001)
_WinAPI_FreeLibrary($hLibrary)
$hSTC = DllCallbackRegister("_StatusBarProcedure", "int", "hWnd;uint;wparam;lparam")
$hOSTC = _WinAPI_SetWindowLong($ConnectStatus, -4, DllCallbackGetPtr($hSTC))消息响应:Func _StatusBarProcedure($hWnd, $iMsg, $iwParam, $ilParam)
Local $iX, $iY
If (($iMsg = $WM_MOUSEMOVE) Or ($iMsg = $WM_LBUTTONDOWN) Or _
($iMsg = $WM_LBUTTONUP) Or ($iMsg = $WM_LBUTTONDBLCLK)) Then
$iX = bitAnd($ilParam, 0xFFFF)
$iY = bitShift($ilParam, 0x10)
If ($iX > 321 And $iX < 358) And ($iY > 0 And $iY < 20) Then
_SetCursor($hCursor)
If ($iMsg = $WM_LBUTTONDOWN) Then
If _GUICtrlStatusBar_GetText($ConnectStatus,2)="标准" Then
GUICtrlSetState($PPCheckBox2,$GUI_Hide)
ControlMove($Title,"",$PPCheckBox1,40,105)
_GUICtrlStatusBar_SetText($ConnectStatus,"增强",2)
GUICtrlSetState($PPIPLabel,$GUI_SHOW)
GUICtrlSetState($PPIPINPUT,$GUI_SHOW)
ElseIf _GUICtrlStatusBar_GetText($ConnectStatus,2)="增强" Then
ControlMove($Title,"",$PPCheckBox1,40,85)
GUICtrlSetState($PPCheckBox2,$GUI_SHOW)
_GUICtrlStatusBar_SetText($ConnectStatus,"标准",2)
GUICtrlSetState($PPIPLabel,$GUI_HIDE)
GUICtrlSetState($PPIPINPUT,$GUI_HIDE)
EndIf
EndIf
EndIf
EndIf
Return _WinAPI_CallWindowProc($hOSTC, $hWnd, $iMsg, $iwParam, $ilParam)
EndFunc ;==>_StatusBarProcedure 是这个效果?#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Local $hGUI, $hProgress, $hButton, $Button, $progress, $hStatus,$Msgbox
Local $aParts =
$hGUI = GUICreate("StatusBar Embed Control", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetMinHeight ($hStatus, 20)
GUISetState()
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)
_GUICtrlStatusBar_SetText ($hStatus, "Part 3", 2)
_GUICtrlStatusBar_SetText ($hStatus, "Part 4", 3)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
$Msgbox=GUIGetMsg()
Switch $Msgbox
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSwitch
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hStatus
Switch $iCode
Case $NM_CLICK ; 鼠标左键点击项目时由控件发送
$tInfo = DllStructCreate($tagNMMOUSE, $ilParam)
Select
Case DllStructGetData($tInfo, "ItemSpec")=0
MsgBox(0,0,"选中第一栏")
Case DllStructGetData($tInfo, "ItemSpec")=1
MsgBox(0,0,"选中第二栏")
Case DllStructGetData($tInfo, "ItemSpec")=2
MsgBox(0,0,"选中第三栏")
Case DllStructGetData($tInfo, "ItemSpec")=3
MsgBox(0,0,"选中第四栏")
EndSelect
Return TRUE ; 表示已获取鼠标点击并由系统禁止默认操作
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
裤头扔下个问题就闪了~
LS几位都能解决LZ的问题 额! 这几天出差了。。所有没看。。问题解决了。。谢谢大家了。。
额。不知道怎么把这个贴移到已解决区。。请版主帮个忙
页:
[1]