cqboyqx
发表于 2018-5-14 18:50:01
本帖最后由 cqboyqx 于 2018-5-14 18:54 编辑
回复 4# afan
你这个是au3写的吗,能发源码出来让我们学习下吗?模仿得太好了
chzj589
发表于 2018-5-15 09:35:08
用Label模拟TAB标签,在点击时设置相关控件(子窗口)的坐标及显示状态,控件较多的话就用子窗口
以下自娱 ...
afan 发表于 2018-5-10 14:06 http://www.autoit3.cn/images/common/back.gif
学习了,动手才能进步
afan
发表于 2018-5-15 10:14:20
回复 16# cqboyqx
当然是au3写的,在本论坛,除了说明非au3编写外,基本都是au3的。
你提出的问题,大家已经给你做出了回答,我那个预览也只是想说明au3能做的事很多,界面自然不在话下。
思路之前就告诉你了。原材料也和你说了,而且加入了你的预览图没有的再次点击会由展开变折叠、展开变色的思路,剩下的可以自己动手。
afan
发表于 2018-5-15 10:16:33
回复 17# chzj589
前辈将坐标调精准点会更好,当然可能也有样式的影响
chzj589
发表于 2018-5-15 10:22:10
回复chzj589
前辈将坐标调精准点会更好,当然可能也有样式的影响
afan 发表于 2018-5-15 10:16 http://www.autoit3.cn/images/common/back.gif
谢谢指导。谢谢!
cqboyqx
发表于 2018-5-15 10:46:46
本帖最后由 cqboyqx 于 2018-5-15 10:49 编辑
回复 18# afan
我想知道你这个线框是这么处理的,处理得那么完好无缝,你就不要吝啬了嘛。让我们菜鸟开哈眼界
chzj589
发表于 2018-5-15 17:11:52
回复chzj589
前辈将坐标调精准点会更好,当然可能也有样式的影响
afan 发表于 2018-5-15 10:16 http://www.autoit3.cn/images/common/back.gif
是系统环境问题,还是控件的样式问题?
我用:GUICtrlCreateLabel("合同管理", 15, 35, 201, 25,$SS_SUNKEN+ $SS_CENTER + $SS_CENTERIMAGE)
就是达不到您的效果
afan
发表于 2018-5-15 18:07:59
是系统环境问题,还是控件的样式问题?
我用:GUICtrlCreateLabel("合同管理", 15, 35, 201, 25,$SS_SUN ...
chzj589 发表于 2018-5-15 17:11 http://www.autoit3.cn/images/common/back.gif
可以用公共样式 $WS_BORDER
GUICtrlCreateLabel('合同管理', 15, 35, 201, 25, $WS_BORDER)
chzj589
发表于 2018-5-15 18:57:35
可以用公共样式 $WS_BORDER
GUICtrlCreateLabel('合同管理', 15, 35, 201, 25, $WS_BORDER)
afan 发表于 2018-5-15 18:07 http://www.autoit3.cn/images/common/back.gif
谢谢!真的是控件的样式问题。
qsy666888
发表于 2018-5-16 11:18:08
本帖最后由 qsy666888 于 2018-5-16 12:33 编辑
根据前面三个大佬的思路,弄了一个
水木子
发表于 2018-5-16 16:57:42
回复cqboyqx
当然是au3写的,在本论坛,除了说明非au3编写外,基本都是au3的。
你提出的问题, ...
afan 发表于 2018-5-15 10:14 http://www.autoit3.cn/images/common/back.gif
同意afan前辈的观点,请不要质疑Au3的能力。
chzj589
发表于 2018-5-17 08:48:25
同意afan前辈的观点,请不要质疑Au3的能力。
水木子 发表于 2018-5-16 16:57 http://www.autoit3.cn/images/common/back.gif
志艺风云
发表于 2018-5-17 10:59:48
根据前面三个大佬的思路,弄了一个
qsy666888 发表于 2018-5-16 11:18 http://www.autoit3.cn/images/common/back.gif
这个好,看着舒服。
水木子
发表于 2018-5-18 14:31:51
本帖最后由 水木子 于 2018-5-19 12:40 编辑
大家都好厉害,模拟出来的效果都这么好。
我也来凑个热闹吧!
附上我的源码,调整数组大小即可获得不同数量的Tab哦!
#include <GuiTreeView.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $aTab
Global $iLeft = 10, $iTop = 10
Global $iTabWidth = 200, $iTabHeight = 40
Global $iSpacingX = 50, $iSpacingY = $iTabHeight - 1
Global $iGuiLeft = 48, $iGuiTop = 49
Global $iGuiWidth = 160, $iGuiHeight = 350
Global $iSelected
Global $bBoolean = False
$hGui1 = GUICreate('', 220, 650)
GUISetBkColor(0xFCE6C9)
GUICtrlSetDefBkColor(0xC0C0C0)
For $i = 0 To UBound($aTab) - 1
$aTab[$i] = GUICtrlCreateLabel('Tab - ' & $i + 1, $iLeft, $iTop + ($iSpacingY * $i), $iTabWidth, $iTabHeight, $SS_CENTER + $SS_CENTERIMAGE + $WS_BORDER)
GUICtrlSetFont(-1, 12, 400, 0, '微软雅黑')
Next
For $i = 0 To UBound($aTab) - 1
$aTab[$i] = GUICtrlCreateIcon('shell32.dll', $i + 10, $iLeft + 10, $iTop + 10 + ($iSpacingY * $i), 16, 16)
Next
$iLine = GUICtrlCreateLabel('', $iGuiLeft + 1, $iGuiTop, $iGuiWidth, 1)
GUICtrlSetState($iLine, $GUI_HIDE)
For $i = 0 To UBound($aTab) - 1
$aTab[$i] = GUICreate('', $iGuiWidth, $iGuiHeight, $iGuiLeft, $iGuiTop + ($iSpacingY * $i), $WS_CHILD + $WS_BORDER, -1, $hGui1)
GUISetBkColor(0xA9A9A9)
GUICtrlSetDefBkColor(0xA9A9A9)
$TreeView1 = GUICtrlCreateTreeView(5, 5, 158, $iGuiHeight - 10)
GUICtrlSetImage(-1, 'shell32.dll', $i + 10)
$TvItem1 = GUICtrlCreateTreeViewItem('TreeView' & $i + 1, $TreeView1)
GUICtrlSetImage(-1, 'shell32.dll', $i + 11)
GUICtrlCreateTreeViewItem('TvItem' & $i + 1 & ' - 1', $TvItem1)
GUICtrlCreateTreeViewItem('TvItem' & $i + 1 & ' - 2', $TvItem1)
GUICtrlCreateTreeViewItem('TvItem' & $i + 1 & ' - 3', $TvItem1)
Next
GUISetState(@SW_SHOW, $hGui1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
ExitLoop
Case $aTab To $aTab
$iIndex = $nMsg - $aTab
If $iSelected <> $iIndex Then
ConsoleWrite($iIndex)
SetCtrlState($iIndex)
Else
If $bBoolean = True Then
SetCtrlState2($iIndex)
$bBoolean = Not $bBoolean
Else
SetCtrlState($iIndex)
$bBoolean = Not $bBoolean
EndIf
EndIf
$iSelected = $iIndex
EndSwitch
WEnd
Func SetCtrlState($iIndex)
Local $iTabTop2
GUICtrlSetBkColor($iLine, 0xA9A9A9)
ControlMove($hGui1, '', $iLine, $iGuiLeft + 1, $iGuiTop + ($iSpacingY * $iIndex))
GUICtrlSetState($iLine, $GUI_SHOW)
For $i = 0 To UBound($aTab) - 1
If $i > $iIndex Then
$iTabTop2 = $iGuiHeight
Else
$iTabTop2 = 10
EndIf
ControlMove($hGui1, '', $aTab[$i], $iLeft, $iTabTop2 + ($iSpacingY * $i))
ControlMove($hGui1, '', $aTab[$i], $iLeft + 10, $iTabTop2 + 10 + ($iSpacingY * $i))
GUICtrlSetState($aTab[$i], $GUI_SHOW)
Next
For $i = 0 To UBound($aTab) - 1
If $i = $iIndex Then
GUICtrlSetBkColor($aTab[$i], 0xA9A9A9)
Else
GUICtrlSetBkColor($aTab[$i], 0xC0C0C0)
EndIf
Next
For $i = 0 To UBound($aTab) - 1
GUISetState(@SW_HIDE, $aTab[$i])
Next
GUISetState(@SW_SHOW, $aTab[$iIndex])
EndFunc ;==>SetCtrlState
Func SetCtrlState2($iIndex)
Local $iTabTop3 = 10
GUICtrlSetBkColor($iLine, 0x646464)
ControlMove($hGui1, '', $iLine, $iGuiLeft + 1, $iGuiTop + ($iSpacingY * $iIndex))
GUICtrlSetState($iLine, $GUI_SHOW)
For $i = 0 To UBound($aTab) - 1
ControlMove($hGui1, '', $aTab[$i], $iLeft, $iTabTop3 + ($iSpacingY * $i))
ControlMove($hGui1, '', $aTab[$i], $iLeft + 10, $iTabTop3 + 10 + ($iSpacingY * $i))
GUICtrlSetState($aTab[$i], $GUI_SHOW)
GUICtrlSetBkColor($aTab[$i], 0xC0C0C0)
Next
For $i = 0 To UBound($aTab) - 1
GUISetState(@SW_HIDE, $aTab[$i])
Next
EndFunc ;==>SetCtrlState
水木子
发表于 2018-5-18 14:35:07
再来个易读版的,免得又有人说数组变量太多,看晕了。
#include <GuiTreeView.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$hGui0 = GUICreate('', 220, 600)
GUISetBkColor(0xFFFFFF)
GUICtrlSetDefBkColor(0xC0C0C0)
$Button1 = GUICtrlCreateLabel('Tab - 1', 10, 10, 200, 40, $SS_CENTER + $SS_CENTERIMAGE + $WS_BORDER)
GUICtrlSetFont(-1, 12, 400, 0, '微软雅黑')
$Button2 = GUICtrlCreateLabel('Tab - 2', 10, 450, 200, 40, $SS_CENTER + $SS_CENTERIMAGE + $WS_BORDER)
GUICtrlSetFont(-1, 12, 400, 0, '微软雅黑')
$Button3 = GUICtrlCreateLabel('Tab - 3', 10, 489, 200, 40, $SS_CENTER + $SS_CENTERIMAGE + $WS_BORDER)
GUICtrlSetFont(-1, 12, 400, 0, '微软雅黑')
$Button4 = GUICtrlCreateLabel('Tab - 4', 10, 528, 200, 40, $SS_CENTER + $SS_CENTERIMAGE + $WS_BORDER)
GUICtrlSetFont(-1, 12, 400, 0, '微软雅黑')
$Button0 = GUICtrlCreateLabel('', 41, 49, 168, 1)
$hGui1 = GUICreate('', 168, 400, 40, 49, $WS_CHILD + $WS_BORDER, -1, $hGui0)
GUISetBkColor(0xC0C0C0)
GUICtrlSetDefBkColor(0xC0C0C0)
$iTreeview1 = GUICtrlCreateTreeView(5, 5, 158, 390)
GUICtrlSetImage(-1, 'shell32.dll', 14)
$iTvItem1 = GUICtrlCreateTreeViewItem('TreeView1', $iTreeview1)
GUICtrlSetImage(-1, 'shell32.dll', 15)
GUICtrlCreateTreeViewItem('TvItem1 - 1', $iTvItem1)
GUICtrlCreateTreeViewItem('TvItem1 - 2', $iTvItem1)
GUICtrlCreateTreeViewItem('TvItem1 - 3', $iTvItem1)
$hGui2 = GUICreate('', 168, 400, 40, 88, $WS_CHILD + $WS_BORDER, -1, $hGui0)
GUISetBkColor(0xC0C0C0)
GUICtrlSetDefBkColor(0xC0C0C0)
$iTreeview2 = GUICtrlCreateTreeView(5, 5, 158, 390)
GUICtrlSetImage(-1, 'shell32.dll', 16)
$iTvItem2 = GUICtrlCreateTreeViewItem('TreeView2', $iTreeview2)
GUICtrlSetImage(-1, 'shell32.dll', 17)
GUICtrlCreateTreeViewItem('TvItem2 - 1', $iTvItem2)
GUICtrlCreateTreeViewItem('TvItem2 - 2', $iTvItem2)
GUICtrlCreateTreeViewItem('TvItem2 - 3', $iTvItem2)
$hGui3 = GUICreate('', 168, 400, 40, 127, $WS_CHILD + $WS_BORDER, -1, $hGui0)
GUISetBkColor(0xC0C0C0)
GUICtrlSetDefBkColor(0xC0C0C0)
$iTreeview3 = GUICtrlCreateTreeView(5, 5, 158, 390)
GUICtrlSetImage(-1, 'shell32.dll', 18)
$iTvItem3 = GUICtrlCreateTreeViewItem('TreeView3', $iTreeview3)
GUICtrlSetImage(-1, 'shell32.dll', 19)
GUICtrlCreateTreeViewItem('TvItem3 - 1', $iTvItem3)
GUICtrlCreateTreeViewItem('TvItem3 - 2', $iTvItem3)
GUICtrlCreateTreeViewItem('TvItem3 - 3', $iTvItem3)
$hGui4 = GUICreate('', 168, 400, 40, 166, $WS_CHILD + $WS_BORDER, -1, $hGui0)
GUISetBkColor(0xC0C0C0)
GUICtrlSetDefBkColor(0xC0C0C0)
$iTreeview4 = GUICtrlCreateTreeView(5, 5, 158, 390)
GUICtrlSetImage(-1, 'shell32.dll', 20)
$iTvItem4 = GUICtrlCreateTreeViewItem('TreeView3', $iTreeview4)
GUICtrlSetImage(-1, 'shell32.dll', 21)
GUICtrlCreateTreeViewItem('TvItem3 - 1', $iTvItem4)
GUICtrlCreateTreeViewItem('TvItem3 - 2', $iTvItem4)
GUICtrlCreateTreeViewItem('TvItem3 - 3', $iTvItem4)
GUISetState(@SW_SHOW, $hGui0)
GUISetState(@SW_SHOW, $hGui1)
While 1
Switch GUIGetMsg()
Case -3
ExitLoop
Case $Button1
ControlMove($hGui0, '', $Button0, 41, 49)
ControlMove($hGui0, '', $Button1, 10, 10)
ControlMove($hGui0, '', $Button2, 10, 450)
ControlMove($hGui0, '', $Button3, 10, 489)
ControlMove($hGui0, '', $Button4, 10, 528)
GUICtrlSetState($Button0, $GUI_SHOW)
GUICtrlSetState($Button1, $GUI_SHOW)
GUICtrlSetState($Button2, $GUI_SHOW)
GUICtrlSetState($Button3, $GUI_SHOW)
GUICtrlSetState($Button4, $GUI_SHOW)
GUISetState(@SW_HIDE, $hGui2)
GUISetState(@SW_HIDE, $hGui3)
GUISetState(@SW_HIDE, $hGui4)
GUISetState(@SW_SHOW, $hGui1)
Case $Button2
ControlMove($hGui0, '', $Button0, 41, 88)
ControlMove($hGui0, '', $Button1, 10, 10)
ControlMove($hGui0, '', $Button2, 10, 49)
ControlMove($hGui0, '', $Button3, 10, 489)
ControlMove($hGui0, '', $Button4, 10, 528)
GUICtrlSetState($Button0, $GUI_SHOW)
GUICtrlSetState($Button1, $GUI_SHOW)
GUICtrlSetState($Button2, $GUI_SHOW)
GUICtrlSetState($Button3, $GUI_SHOW)
GUICtrlSetState($Button4, $GUI_SHOW)
GUISetState(@SW_HIDE, $hGui1)
GUISetState(@SW_HIDE, $hGui3)
GUISetState(@SW_HIDE, $hGui4)
GUISetState(@SW_SHOW, $hGui2)
Case $Button3
ControlMove($hGui0, '', $Button0, 41, 127)
ControlMove($hGui0, '', $Button1, 10, 10)
ControlMove($hGui0, '', $Button2, 10, 49)
ControlMove($hGui0, '', $Button3, 10, 88)
ControlMove($hGui0, '', $Button4, 10, 528)
GUICtrlSetState($Button0, $GUI_SHOW)
GUICtrlSetState($Button1, $GUI_SHOW)
GUICtrlSetState($Button2, $GUI_SHOW)
GUICtrlSetState($Button3, $GUI_SHOW)
GUICtrlSetState($Button4, $GUI_SHOW)
GUISetState(@SW_HIDE, $hGui1)
GUISetState(@SW_HIDE, $hGui2)
GUISetState(@SW_HIDE, $hGui4)
GUISetState(@SW_SHOW, $hGui3)
Case $Button4
ControlMove($hGui0, '', $Button0, 41, 166)
ControlMove($hGui0, '', $Button1, 10, 10)
ControlMove($hGui0, '', $Button2, 10, 49)
ControlMove($hGui0, '', $Button3, 10, 88)
ControlMove($hGui0, '', $Button4, 10, 127)
GUICtrlSetState($Button0, $GUI_SHOW)
GUICtrlSetState($Button1, $GUI_SHOW)
GUICtrlSetState($Button2, $GUI_SHOW)
GUICtrlSetState($Button3, $GUI_SHOW)
GUICtrlSetState($Button4, $GUI_SHOW)
GUISetState(@SW_HIDE, $hGui1)
GUISetState(@SW_HIDE, $hGui2)
GUISetState(@SW_HIDE, $hGui3)
GUISetState(@SW_SHOW, $hGui4)
EndSwitch
WEnd