找回密码
 加入
搜索
查看: 262506|回复: 678

[皮肤] 360界面放送,20111115更新

[复制链接]
发表于 2011-11-14 12:26:26 | 显示全部楼层 |阅读模式
本帖最后由 seniors 于 2013-3-7 14:03 编辑

先贴图,看看发在GUI交流版效果怎么样,好像这里的附件是不花钱的




老规矩,代码回复可见,这次用到了大量图片,故上传压缩档。
这次代码使用3.3.6.1版,如果你使用的版本出现578行错误,原来是不出现错误的,是不出现图片,注意,不出现图片请按下面方法改一下
_WinAPI_UpdateLayeredWindowEx($zhu_gui, $hBitMap, 255, 1)
改为_WinAPI_UpdateLayeredWindowEx($zhu_gui,-1,-1, $hBitMap, 255, 1)

出现_WinAPI_UpdateLayeredWindowEx未知函数错误的,请在开头加上
#Include <WinAPIEx.au3>

11.15更新,增加的较详细的注释,解决了tip不消失的现象
现在还存在移动鼠标GDI对象增加的问题,希望大家能一起研究,附件更新
3.3.7.15版不出现GDI对象增加的问题
2012.03.02:阴影部分修改
游客,如果您要查看本帖隐藏内容请回复

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#Include <WinAPIEx.au3>
#include <GDIPlusEx.au3>
#include <Thread.au3>
Opt('GUIOnEventMode', 1)
_RTEmptyWorkingSet();减少内存占用
;窗口宽度,高度,圆角
Global $zhuwidth = 600, $zhuheight = 400, $winround = 10
;配色颜色数组,当前皮肤序号
Global $pifucolor[5] = [0xFF0860a8, 0xFFFFAA00, 0xFF00AAFF, 0xFF990000, 0xFF009a20], $pifu = 0
;皮肤图片文件数组,第一个为“”空,是一个标志,为空则按本色显示,当前皮肤序号
Global $imgpifu[6] = ["", @ScriptDir & "\top\1.jpg", @ScriptDir & "\top\2.jpg", @ScriptDir & "\top\3.jpg", @ScriptDir & "\top\4.jpg", @ScriptDir & "\top\5.jpg"], $imgNum = 1
;大图标区域数组,当前选中序号,当前hover序号,当前hover标识,当hover标识和hover序号相同时不重绘
Global $PanBtnRect[6], $SelectPanBtn = 1, $OnPanBtnNum = 0, $OnPanBtnFlag = 0
;系统按钮区域数组,系统按钮hover图片文件数组,系统按钮Down图片文件数组,系统按钮tip数组,hoevr按钮标识,hover按钮序号,标识序号相同不重绘,Down按钮序号
Global $topbutton[7], $topbuttonhoverimg[7], $topbuttondownimg[7], $topbuttontip[7], $onTopbuttonFlag = 0, $onTopbuttonNum = 0, $DownTopbuttonNum = 0

;外形窗口建立
Global $zhu_gui = GUICreate("360界面预览", $zhuwidth, $zhuheight, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
_GDIPlus_Startup()
_initRect();按钮区域等初始设置
;注册窗口消息函数
GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
GUIRegisterMsg($WM_LBUTTONDOWN, 'WM_LBUTTONDOWN')
GUIRegisterMsg($WM_LBUTTONUP, 'WM_LBUTTONUP')
;中间的内容窗口建立
$ne_gui = GUICreate("", $zhuwidth - 10, 260, 8, 110, $WS_POPUP, $WS_EX_MDICHILD, $zhu_gui)
$mylabel = GUICtrlCreateLabel("第一页", 10, 10, $zhuwidth - 20, 30)
GUICtrlSetFont(-1, 24)
GUICtrlSetColor(-1, 0x0860a8)
;显示窗口
_DrawBk( _hoverBTN($SelectPanBtn, $OnPanBtnNum))
GUISetState(@SW_SHOW, $ne_gui)
GUISetState(@SW_SHOW, $zhu_gui)


While 1
        $MOusePoint = _WinAPI_GetMousePos()
        $winrect = _WinAPI_GetWindowRect($zhu_gui)
        If Not _WinAPI_PtInRect($winrect, $MOusePoint) Then ToolTip("");如果鼠标在窗口外则取消tip
        Sleep(10)
WEnd

Func exitfunc()
        _GDIPlus_Shutdown()
        Exit
EndFunc   ;==>exitfunc

Func _initRect();初始化系统按钮图标位置,中间大按钮位置等
        For $iI = 1 To 6;初始化6个大按钮位置
                $PanBtnRect[$iI - 1] = DllStructCreate($tagRECT)
                DllStructSetData($PanBtnRect[$iI - 1], 1, 10 + ($iI - 1) * 70)
                DllStructSetData($PanBtnRect[$iI - 1], 2, 30)
                DllStructSetData($PanBtnRect[$iI - 1], 3, $iI * 70)
                DllStructSetData($PanBtnRect[$iI - 1], 4, 90)
        Next
        ;初始化右上角系统按钮位置,及系统按钮hover,Down图像及提示信息
        Local $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnClose.png")
        $mybtnx = $zhuwidth - 2 - _GDIPlus_ImageGetWidth($kzImage)
        $topbutton[0] = DllStructCreate($tagRECT)
        DllStructSetData($topbutton[0], 1, $mybtnx)
        DllStructSetData($topbutton[0], 2, 1)
        DllStructSetData($topbutton[0], 3, $mybtnx + _GDIPlus_ImageGetWidth($kzImage))
        DllStructSetData($topbutton[0], 4, _GDIPlus_ImageGetHeight($kzImage) + 1)
        $topbuttonhoverimg[0] = @ScriptDir & "\top\TopPanelCloseOver.png"
        $topbuttondownimg[0] = @ScriptDir & "\top\TopPanelCloseDown.png"
        $topbuttontip[0] = "关闭"
        
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnMax.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        $topbutton[1] = DllStructCreate($tagRECT)
        DllStructSetData($topbutton[1], 1, $mybtnx + 1)
        DllStructSetData($topbutton[1], 2, 1)
        DllStructSetData($topbutton[1], 3, $mybtnx + _GDIPlus_ImageGetWidth($kzImage))
        DllStructSetData($topbutton[1], 4, _GDIPlus_ImageGetHeight($kzImage) + 1)
        $topbuttonhoverimg[1] = @ScriptDir & "\top\MiddleOver.png"
        $topbuttondownimg[1] = @ScriptDir & "\top\MiddleDown.png"
        $topbuttontip[1] = "最大化"
        
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnMin.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        $topbutton[2] = DllStructCreate($tagRECT)
        DllStructSetData($topbutton[2], 1, $mybtnx + 1)
        DllStructSetData($topbutton[2], 2, 1)
        DllStructSetData($topbutton[2], 3, $mybtnx + _GDIPlus_ImageGetWidth($kzImage))
        DllStructSetData($topbutton[2], 4, _GDIPlus_ImageGetHeight($kzImage) + 1)
        $topbuttonhoverimg[2] = @ScriptDir & "\top\MiddleOver.png"
        $topbuttondownimg[2] = @ScriptDir & "\top\MiddleDown.png"
        $topbuttontip[2] = "最小化"
        
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnSetting.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        $topbutton[3] = DllStructCreate($tagRECT)
        DllStructSetData($topbutton[3], 1, $mybtnx + 1)
        DllStructSetData($topbutton[3], 2, 1)
        DllStructSetData($topbutton[3], 3, $mybtnx + _GDIPlus_ImageGetWidth($kzImage))
        DllStructSetData($topbutton[3], 4, _GDIPlus_ImageGetHeight($kzImage) + 1)
        $topbuttonhoverimg[3] = @ScriptDir & "\top\MiddleOver.png"
        $topbuttondownimg[3] = @ScriptDir & "\top\MiddleDown.png"
        $topbuttontip[3] = "设置"
        
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnFeedback.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        $topbutton[4] = DllStructCreate($tagRECT)
        DllStructSetData($topbutton[4], 1, $mybtnx)
        DllStructSetData($topbutton[4], 2, 1)
        DllStructSetData($topbutton[4], 3, $mybtnx + _GDIPlus_ImageGetWidth($kzImage))
        DllStructSetData($topbutton[4], 4, _GDIPlus_ImageGetHeight($kzImage) + 1)
        $topbuttonhoverimg[4] = @ScriptDir & "\top\over.png"
        $topbuttondownimg[4] = @ScriptDir & "\top\mask.png"
        $topbuttontip[4] = "反馈"
        
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\skin.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        $topbutton[5] = DllStructCreate($tagRECT)
        DllStructSetData($topbutton[5], 1, $mybtnx)
        DllStructSetData($topbutton[5], 2, 1)
        DllStructSetData($topbutton[5], 3, $mybtnx + _GDIPlus_ImageGetWidth($kzImage))
        DllStructSetData($topbutton[5], 4, _GDIPlus_ImageGetHeight($kzImage) + 1)
        $topbuttonhoverimg[5] = @ScriptDir & "\top\over.png"
        $topbuttondownimg[5] = @ScriptDir & "\top\mask.png"
        $topbuttontip[5] = "皮肤"
        
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnSkin.png")
        $mybtnx = $zhuwidth - 20 - _GDIPlus_ImageGetWidth($kzImage)
        $topbutton[6] = DllStructCreate($tagRECT)
        DllStructSetData($topbutton[6], 1, $mybtnx)
        DllStructSetData($topbutton[6], 2, 30)
        DllStructSetData($topbutton[6], 3, $mybtnx + _GDIPlus_ImageGetWidth($kzImage))
        DllStructSetData($topbutton[6], 4, _GDIPlus_ImageGetHeight($kzImage) + 30)
        $topbuttonhoverimg[6] = @ScriptDir & "\top\over.png"
        $topbuttondownimg[6] = @ScriptDir & "\top\mask.png"
        $topbuttontip[6] = "配色"
        
        _WinAPI_DeleteObject($kzImage)
EndFunc   ;==>_initRect

#cs
        窗口背景图像绘制
        $mywidth,$myheight是窗口宽度和高度
        $mycolor是窗口背景颜色
        $myskin是窗口背景图片,如果无背景图片则是纯背景色,有图片则背景用图片、此时背景颜色不起作用
        $myround是窗口圆角大小
        后面四个参数是指是否圆角
#ce
Func _myback($mywidth, $myheight, $mycolor = 0xFF0860a8, $myskin = "", $myround = 10, $myleftup = True, $myrightup = True, $myleftdown = True, $myrightdown = True)
        Local $hHBITMAP = _WinAPI_CreateBitmap($mywidth, $myheight, 1, 32);建立背景位图
        Local $hCDC = _WinAPI_CreateCompatibleDC(0);建立绘图DC
        Local $hOld = _WinAPI_SelectObject($hCDC, $hHBITMAP);调入图片到DC
        Local $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hCDC);从DC创建图形对象
        _GDIPlus_GraphicsClear($hGraphic, 0x00000000);清空图形
        _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2);绘制质量 2 - 使用 8 X 8 矩形过滤器
        _GDIPlus_GraphicsSetInterpolationMode($hGraphic, 7);插值法 7=High-quality, bicubic interpolation.
        $hPath = _myPath(0, 0, $mywidth, $myheight);建立窗口四周圆角的路径
        $hPen = _GDIPlus_PenCreate(0xFF000000, 1, 0);创建描边黑色画笔,线宽为1
        _GDIPlus_PenSetLineJoin($hPen, 2);2 指画笔转变处用圆角光滑处理
        DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGraphic, "hwnd", $hPen, "hwnd", $hPath);依据路径用画笔描边
        If $myskin = "" Then;如果没有背景图片,则画背景颜色
                Local $tRect = _GDIPlus_RectFCreate(0, 0, 40, $myheight);设置区域色块
                Local $hBrush = _GDIPlus_LineBrushCreateFromRect($tRect, 0xaaffffff, $mycolor, 1, 3);设置渐变画刷
                Local $tBlends[5][2];颜色分配方案
                $tBlends[0][0] = 4;有4个关键位置
                $tBlends[1][0] = 0.05;第一个位置的颜色按渐变色中的0.05比例
                $tBlends[1][1] = 0.0;第一位置在填充区域的0位置,即起始位置
                $tBlends[2][0] = 1;第二个位置的颜色按渐变色的1比例,即100%也就是上面设置画刷中的$mycolor色
                $tBlends[2][1] = 0.05;第二个位置在填充区域0.05比例处
                $tBlends[3][0] = 0.9
                $tBlends[3][1] = 0.9
                $tBlends[4][0] = 1
                $tBlends[4][1] = 1.0
                _GDIPlus_LineBrushSetBlend($hBrush, $tBlends);使画刷按颜色分配方案设置
                DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $hBrush, "hwnd", $hPath);用画刷填充路径
                _GDIPlus_BrushDispose($hBrush);销毁画刷
        Else;若有图片,则画背景图片
                Local $kzImage = _GDIPlus_ImageLoadFromFile($myskin);载入图片文件
                Local $imgwidth = $mywidth;临时变量$imgwidth设为窗口宽度
                If _GDIPlus_ImageGetWidth($kzImage) < $mywidth Then $imgwidth = _GDIPlus_ImageGetWidth($kzImage);如图片宽度小于窗口宽度,则高为图片的宽度
                Local $imgheight = $myheight
                If _GDIPlus_ImageGetHeight($kzImage) < $myheight Then $imgheight = _GDIPlus_ImageGetHeight($kzImage)
                $mypictexture = _GDIPlus_TextureCreate2($kzImage, 0, 0, $imgwidth, $imgheight, 3);建立以图片为填充内容画刷,3为如果填充区域大于图片则上下左右要翻转
                DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $mypictexture, "hwnd", $hPath);以画刷填充路径
                _GDIPlus_BrushDispose($mypictexture);销毁画刷
                _WinAPI_DeleteObject($kzImage)
                
        EndIf
        ;路径渐变画刷
;~         Local $aPoints[4][2]
;~         $aPoints[0][0]=3
;~         _GDIPlus_PathBrushCreate($aPoints, $iWrapMode = 0)
;~         _GDIPlus_PathBrushGetBlend($hPathGradientBrush)
        
        _GDIPlus_PathDispose($hPath);销毁路径
        _GDIPlus_PenDispose($hPen);销毁画笔
        ;以下是画出左上角的系统按钮底图
        Local $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnClose.png")
        $mybtnx = $mywidth - 2 - _GDIPlus_ImageGetWidth($kzImage)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), $mybtnx, 1, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnMax.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), $mybtnx, 1, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnMin.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), $mybtnx, 1, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnSetting.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), $mybtnx, 1, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnFeedback.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), $mybtnx, 1, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\skin.png")
        $mybtnx -= _GDIPlus_ImageGetWidth($kzImage)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), $mybtnx + 1, 2, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\top\TopPanelBtnSkin.png")
        $mybtnx = $mywidth - 20 - _GDIPlus_ImageGetWidth($kzImage)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), $mybtnx, 30, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        _WinAPI_DeleteObject($kzImage)
        ;系统按钮绘制结束
        
        $hFamily = _GDIPlus_FontFamilyCreate("黑体")
        $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
        $tLayout = _GDIPlus_RectFCreate(5, 5)
        $hPath = _GDIPlus_PathCreate()
        _GDIPlus_PathAddString($hPath, "250流氓软件", $tLayout, $hFamily, 1, 16, 0);读取字体外形为路径;0是正常字,16是字号
        DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $hBrush, "hwnd", $hPath)
        _GDIPlus_PathDispose($hPath)
        $hPath = _GDIPlus_PathCreate()
        $tLayout = _GDIPlus_RectFCreate(5, $myheight - 25)
        _GDIPlus_PathAddString($hPath, "沙子制作 By seniors 2011", $tLayout, $hFamily, 0, 12, 0);读取字体外形为路径;0是正常字,12是字号
        DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $hBrush, "hwnd", $hPath)
        _GDIPlus_PathDispose($hPath)
        _GDIPlus_FontFamilyDispose($hFamily)
        _GDIPlus_BrushDispose($hBrush)
        _GDIPlus_GraphicsDispose($hGraphic)
        _WinAPI_SelectObject($hCDC, $hOld)
        _WinAPI_DeleteDC($hCDC)
        Return $hHBITMAP
EndFunc   ;==>_myback

Func _hoverBTN($i, $j);绘制中间大图标,$i为当前选中的图标序号,$j为当前处于hover状态的图标序号、当等于0时为无hover图标
        ;建立底图位图
        Local $hHBITMAP = _myback($zhuwidth, $zhuheight, $pifucolor[$pifu], $imgpifu[$imgNum], $winround, True, True, True, True)
        Local $hCDC = _WinAPI_CreateCompatibleDC(0);建立DC
        Local $hOld = _WinAPI_SelectObject($hCDC, $hHBITMAP);把底图调入DC
        Local $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hCDC);根据DC建立图形对象
        $hPath = _myPath(8 + 70 * ($i - 1), 25, 66, 80, 5,True);根据$i建立当前选中图标的高亮区域阴影路径,
        ;和前面注释相同部分不注释了,下面是高亮阴影绘制,
        $hPen = _GDIPlus_PenCreate(0x33000000, 1, 0)
        _GDIPlus_PenSetLineJoin($hPen, 2);2 - Line join produces a smooth, circular arc between the lines.
        DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGraphic, "hwnd", $hPen, "hwnd", $hPath)
        _GDIPlus_PenDispose($hPen)
        _GDIPlus_PathDispose($hPath)
        ;以下是高亮区域描边
        $hPath = _myPath(7 + 70 * ($i - 1), 24, 66, 80, 5)
        $hPen = _GDIPlus_PenCreate(0x77FFFFFF, 1, 0)
        _GDIPlus_PenSetLineJoin($hPen, 2);2 - Line join produces a smooth, circular arc between the lines.
        DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGraphic, "hwnd", $hPen, "hwnd", $hPath)
        _GDIPlus_PenDispose($hPen)
        ;填充高亮区域
        $tRect = _GDIPlus_RectFCreate(0, 0, 70, 110);设置区域色块
        $hBrush = _GDIPlus_LineBrushCreateFromRect($tRect, 0x99FFFFFF, 0x33FFFFFF, 1, 3)
        Local $tBlends2[5][2]
        $tBlends2[0][0] = 4
        $tBlends2[1][0] = 0.01
        $tBlends2[1][1] = 0.0
        $tBlends2[2][0] = 0.1
        $tBlends2[2][1] = 0.5
        $tBlends2[3][0] = 1
        $tBlends2[3][1] = 0.5
        $tBlends2[4][0] = 1
        $tBlends2[4][1] = 1.0
        _GDIPlus_LineBrushSetBlend($hBrush, $tBlends2)
        DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $hBrush, "hwnd", $hPath)
        _GDIPlus_BrushDispose($hBrush)
        _GDIPlus_PathDispose($hPath)
        
        If $j <> 0 Then;如有hover图标,则绘制hover高亮区域
                $hPath = _myPath(8 + 70 * ($j - 1), 25, 66, 80, 5,True );阴影路径
                $hPen = _GDIPlus_PenCreate(0x22000000, 1, 0)
                _GDIPlus_PenSetLineJoin($hPen, 2);2 - Line join produces a smooth, circular arc between the lines.
                DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGraphic, "hwnd", $hPen, "hwnd", $hPath)
                _GDIPlus_PenDispose($hPen)
                _GDIPlus_PathDispose($hPath)
                $hPath = _myPath(7 + 70 * ($j - 1), 24, 66, 80, 5);高亮路径
                $hPen = _GDIPlus_PenCreate(0x33FFFFFF, 1, 0)
                _GDIPlus_PenSetLineJoin($hPen, 2);2 - Line join produces a smooth, circular arc between the lines.
                DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGraphic, "hwnd", $hPen, "hwnd", $hPath)
                _GDIPlus_PenDispose($hPen)
                $tRect = _GDIPlus_RectFCreate(0, 0, 70, 110);设置区域色块
                $hBrush = _GDIPlus_LineBrushCreateFromRect($tRect, 0x55FFFFFF, 0x11FFFFFF, 1, 3)
                Local $tBlends2[5][2]
                $tBlends2[0][0] = 4
                $tBlends2[1][0] = 0.01
                $tBlends2[1][1] = 0.0
                $tBlends2[2][0] = 0.1
                $tBlends2[2][1] = 0.5
                $tBlends2[3][0] = 1
                $tBlends2[3][1] = 0.5
                $tBlends2[4][0] = 1
                $tBlends2[4][1] = 1.0
                _GDIPlus_LineBrushSetBlend($hBrush, $tBlends2)
                DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $hBrush, "hwnd", $hPath)
                _GDIPlus_BrushDispose($hBrush)
                _GDIPlus_PathDispose($hPath)
        EndIf
        
        ;绘制中间大图标,因为大图标位于高亮上方,所以没有在背景底纹中绘制
        For $iI = 1 To 6
                $kzImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\app\" & $iI & ".png")
                _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), DllStructGetData($PanBtnRect[$iI - 1], 1), DllStructGetData($PanBtnRect[$iI - 1], 2), 60, 60)
                _WinAPI_DeleteObject($kzImage)
        Next
        ;销毁操作
        
        _GDIPlus_GraphicsDispose($hGraphic)
        _WinAPI_SelectObject($hCDC, $hOld)
        _WinAPI_DeleteDC($hCDC)

        Return $hHBITMAP
EndFunc   ;==>_hoverBTN

Func _huanfu();换配色,不想用弹出窗口选择颜色了,简单点,按一次本色本色按钮颜色选择+1
        $pifu += 1;颜色变量序号加1
        $imgNum = 0;背景图象序号设为0,0序号里是无文件
        If $pifu == UBound($pifucolor) Then $pifu = 0;如果颜色序号走出预设颜色数,归0
        ;显示更换颜色后的窗口
        _DrawBk( _hoverBTN($SelectPanBtn, $OnPanBtnNum))
EndFunc   ;==>_huanfu

Func _huanimg();换背景图片
        $imgNum += 1
        If $imgNum == UBound($imgpifu) Then $imgNum = 1;如背景图片序号超出预设背景数,归1,因为0 为无背景图片
        _DrawBk( _hoverBTN($SelectPanBtn, $OnPanBtnNum))
EndFunc   ;==>_huanimg

Func _topbutton($btRect, $file);绘制系统按钮hover或者Down的图象,$btRect为区域,$file为要画的图象文件
        Local $hHBITMAP = _hoverBTN($SelectPanBtn, $OnPanBtnNum)
        Local $hCDC = _WinAPI_CreateCompatibleDC(0)
        Local $hOld = _WinAPI_SelectObject($hCDC, $hHBITMAP)
        Local $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hCDC)
        Local $kzImage = _GDIPlus_ImageLoadFromFile($file)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), DllStructGetData($btRect, 1), DllStructGetData($btRect, 2), _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage))
        _WinAPI_DeleteObject($kzImage)
        _GDIPlus_GraphicsDispose($hGraphic)
        _WinAPI_SelectObject($hCDC, $hOld)
        _WinAPI_DeleteDC($hCDC)
        Return $hHBITMAP
EndFunc   ;==>_topbutton

Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam);鼠标在窗口范围的检测
        Local $tPoint = _WinAPI_GetMousePos(True, $hWnd)
        Local $wrect = _WinAPI_GetWindowRect($zhu_gui)
        Switch $hWnd
                Case $zhu_gui
                        ;hover标识归0
                        $OnPanBtnFlag = 0
                        $onTopbuttonFlag = 0
                        ;检测鼠标是否在大图标区域,在则置hover标识
                        For $iI = 1 To 6
                                If _WinAPI_PtInRect($PanBtnRect[$iI - 1], $tPoint) Then
                                        $OnPanBtnFlag = $iI
                                        ExitLoop
                                EndIf
                        Next
                        ;检测鼠标是否在系统按钮区域,在则置hover标识
                        For $iI = 1 To 7
                                If _WinAPI_PtInRect($topbutton[$iI - 1], $tPoint) Then
                                        $onTopbuttonFlag = $iI
                                        ExitLoop
                                EndIf
                        Next
                        ;处理hover重绘
                        If $OnPanBtnFlag == 0 And $OnPanBtnNum <> $OnPanBtnFlag Then
                                $OnPanBtnNum = $OnPanBtnFlag
                                _DrawBk( _hoverBTN($SelectPanBtn, $OnPanBtnNum))
                        ElseIf $onTopbuttonFlag == 0 And $onTopbuttonNum <> $onTopbuttonFlag Then
                                ToolTip("")
                                $onTopbuttonNum = $onTopbuttonFlag
                                _DrawBk( _hoverBTN($SelectPanBtn, $OnPanBtnNum))
                        ElseIf $OnPanBtnFlag == 0 And $onTopbuttonFlag == 0 Then
                                If $DownTopbuttonNum > 0 Then
                                        $DownTopbuttonNum = 0
                                        _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                EndIf
                                Return $HTCAPTION
                        ElseIf $SelectPanBtn <> $OnPanBtnFlag And $OnPanBtnNum <> $OnPanBtnFlag Then
                                $OnPanBtnNum = $OnPanBtnFlag
                                $OnPanBtnFlag = 0
                                _DrawBk( _hoverBTN($SelectPanBtn, $OnPanBtnNum))
                                Return $HTOBJECT
                        ElseIf $onTopbuttonFlag > 0 And $onTopbuttonNum <> $onTopbuttonFlag Then
                                $onTopbuttonNum = $onTopbuttonFlag
                                $onTopbuttonFlag = 0
                                _DrawBk(_topbutton($topbutton[$onTopbuttonNum - 1], $topbuttonhoverimg[$onTopbuttonNum - 1]))
                                ToolTip($topbuttontip[$onTopbuttonNum - 1], DllStructGetData($wrect, 1) + DllStructGetData($topbutton[$onTopbuttonNum - 1], 1), DllStructGetData($wrect, 2) + DllStructGetData($topbutton[$onTopbuttonNum - 1], 2) + 30)
                                Return $HTOBJECT
                        EndIf
        EndSwitch
EndFunc   ;==>WM_NCHITTEST

Func WM_LBUTTONDOWN($hWnd, $Msg, $wParam, $lParam);鼠标左键点击处理
        Local $tPoint, $DownTopbuttonFlag, $DownPanBtnFlag
        $tPoint = _WinAPI_GetMousePos(True, $hWnd)
        Switch $hWnd
                Case $zhu_gui
                        $DownPanBtnFlag = 0
                        $DownTopbuttonFlag = 0
                        ;检测鼠标是否在大图标区域,在则置hover标识
                        For $iI = 1 To 6
                                If _WinAPI_PtInRect($PanBtnRect[$iI - 1], $tPoint) Then
                                        $DownPanBtnFlag = $iI
                                        ExitLoop
                                EndIf
                        Next
                        ;检测鼠标是否在系统按钮区域,在则置hover标识
                        For $iI = 1 To 7
                                If _WinAPI_PtInRect($topbutton[$iI - 1], $tPoint) Then
                                        $DownTopbuttonFlag = $iI
                                        ExitLoop
                                EndIf
                        Next
                        ;处理对应的鼠标左键点击
                        ;处理大图标区域的点击
                        Switch $DownPanBtnFlag
                                Case 1
                                        If $SelectPanBtn <> $DownPanBtnFlag Then
                                                $SelectPanBtn = $DownPanBtnFlag
                                                _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                                GUICtrlSetData($mylabel, "第一页")
                                        EndIf
                                Case 2
                                        If $SelectPanBtn <> $DownPanBtnFlag Then
                                                $SelectPanBtn = $DownPanBtnFlag
                                                _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                                GUICtrlSetData($mylabel, "第二页")
                                        EndIf
                                Case 3
                                        If $SelectPanBtn <> $DownPanBtnFlag Then
                                                $SelectPanBtn = $DownPanBtnFlag
                                                _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                                GUICtrlSetData($mylabel, "第三页")
                                        EndIf
                                Case 4
                                        If $SelectPanBtn <> $DownPanBtnFlag Then
                                                $SelectPanBtn = $DownPanBtnFlag
                                                _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                                GUICtrlSetData($mylabel, "第四页")
                                        EndIf
                                Case 5
                                        If $SelectPanBtn <> $DownPanBtnFlag Then
                                                $SelectPanBtn = $DownPanBtnFlag
                                                _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                                GUICtrlSetData($mylabel, "第五页")
                                        EndIf
                                Case 6
                                        If $SelectPanBtn <> $DownPanBtnFlag Then
                                                $SelectPanBtn = $DownPanBtnFlag
                                                _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                                GUICtrlSetData($mylabel, "第六页")
                                        EndIf
                        EndSwitch
                        ;处理系统按钮区域的点击        
                        Switch $DownTopbuttonFlag
                                Case 1 To 7
                                        If $DownTopbuttonNum <> $DownTopbuttonFlag Then
                                                $DownTopbuttonNum = $DownTopbuttonFlag
                                                _DrawBk(_topbutton($topbutton[$DownTopbuttonNum - 1], $topbuttondownimg[$DownTopbuttonNum - 1]))
                                                ToolTip("")
                                        EndIf
                        EndSwitch
        EndSwitch
EndFunc   ;==>WM_LBUTTONDOWN

Func WM_LBUTTONUP($hWnd, $Msg, $wParam, $lParam);鼠标左键释放处理
        Local $tPoint, $DownTopbuttonFlag
        $tPoint = _WinAPI_GetMousePos(True, $hWnd)
        Switch $hWnd
                Case $zhu_gui
                        $DownTopbuttonFlag = 0
                        ;检测左键释放时d在系统按钮区域的位置
                        For $iI = 1 To 7
                                If _WinAPI_PtInRect($topbutton[$iI - 1], $tPoint) Then
                                        $DownTopbuttonFlag = $iI
                                        ExitLoop
                                EndIf
                        Next
                        ;处理相应位置释放时的功能
                        Switch $DownTopbuttonFlag
                                Case 1
                                        exitfunc()
                                Case 2
                                        $DownTopbuttonNum = 0
                                        _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                        MsgBox(0, "", " 测试 ", 2, $zhu_gui)
                                        Return
                                Case 3
                                        $DownTopbuttonNum = 0
                                        _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                        GUISetState(@SW_MINIMIZE, $zhu_gui)
                                        ToolTip("")
                                        Return
                                Case 4
                                        $DownTopbuttonNum = 0
                                        _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                        MsgBox(0, "", " 测试 ", 2, $zhu_gui)
                                        Return
                                Case 5
                                        $DownTopbuttonNum = 0
                                        _DrawBk( _hoverBTN($SelectPanBtn, 0))
                                        ShellExecute("http://www.autoitx.com/thread-28704-1-1.html")
                                        Return
                                Case 6
                                        _huanimg()
                                        $DownTopbuttonNum = 0
                                        Return
                                Case 7
                                        _huanfu()
                                        $DownTopbuttonNum = 0
                                        Return
                        EndSwitch
        EndSwitch
EndFunc   ;==>WM_LBUTTONUP

;圆角路径建立
Func _myPath($myx, $myy, $mywidth, $myheight, $myround = 10, $dr = False, $myleftup = True, $myrightup = True, $myleftdown = True, $myrightdown = True)
        Local $hPath = _GDIPlus_PathCreate()
        If $dr Then ;为TRUE时返回二条阴影边的路径
                _GDIPlus_PathAddLine($hPath, $myx+$myround, $myy+$myheight, $myx+$mywidth-$myround, $myy+$myheight)
                _GDIPlus_PathAddArc($hPath, $myx + $mywidth - $myround - 1, $myy + $myheight - $myround - 1, $myround, $myround, 0, 90)
                _GDIPlus_PathAddLine($hPath, $myx+$mywidth, $myy+$myheight-$myround, $myx+$mywidth, $myy+$myround)
                Return $hPath
        EndIf
        If $myleftup Then
                _GDIPlus_PathAddArc($hPath, $myx, $myy, $myround, $myround, 180, 90)
        Else
                _GDIPlus_PathAddLine($hPath, $myx, $myy, $myx, $myy)
        EndIf
        If $myrightup Then
                _GDIPlus_PathAddArc($hPath, $myx + $mywidth - $myround - 1, $myy, $myround, $myround, 270, 90)
        Else
                _GDIPlus_PathAddLine($hPath, $myx + $mywidth - 1, $myy, $myx + $mywidth - 1, $myy)
        EndIf
        If $myrightdown Then
                _GDIPlus_PathAddArc($hPath, $myx + $mywidth - $myround - 1, $myy + $myheight - $myround - 1, $myround, $myround, 0, 90)
        Else
                _GDIPlus_PathAddLine($hPath, $myx + $mywidth - 1, $myy + $myheight - 1, $myx + $mywidth - 1, $myy + $myheight - 1)
        EndIf
        If $myleftdown Then
                _GDIPlus_PathAddArc($hPath, $myx, $myy + $myheight - $myround - 1, $myround, $myround, 90, 90)
        Else
                _GDIPlus_PathAddLine($hPath, $myx, $myy + $myheight - 1, $myx, $myy + $myheight - 1)
        EndIf
        _GDIPlus_PathCloseFigures($hPath)
        Return $hPath
EndFunc   ;==>_myPath

Func _DrawBk($hBitMap);更新窗口
        _WinAPI_UpdateLayeredWindowEx($zhu_gui, -1,-1, $hBitMap, 255, 1);可能3.3.7开始这个函数有改变,请在$hBitMap前加上二个参数-1,-1
EndFunc   ;==>_DrawBk

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×

评分

参与人数 12威望 +2 金钱 +396 贡献 +65 收起 理由
heavenm + 80 + 20
xms77 + 20 + 2 很漂亮的皮肤,学习一下,借用一下!
cuihairu + 20
lynfr8 + 13
kodin + 50 “流氓软件”四个大字,实在太酷,太耀眼了 ...

查看全部评分

发表于 2011-11-14 12:37:50 | 显示全部楼层
呵呵 效果不错~!~支持下
发表于 2011-11-14 12:41:14 | 显示全部楼层
本帖最后由 .個朲綉√ 于 2011-11-14 13:08 编辑

太牛了,前排支持啊

WIN7 64位运行出错,选择X86运行正常.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2011-11-14 12:41:14 | 显示全部楼层
呵呵 效果不错~!~支持下
zcool321 发表于 2011-11-14 12:37

现在传好代码了
发表于 2011-11-14 12:46:43 | 显示全部楼层
看看啥内容
发表于 2011-11-14 12:58:04 | 显示全部楼层
哇,自定义皮肤耶
发表于 2011-11-14 12:58:14 | 显示全部楼层
效果不错,很强大
发表于 2011-11-14 13:23:21 | 显示全部楼层
太漂亮了,支持一下。
 楼主| 发表于 2011-11-14 13:24:28 | 显示全部楼层
太牛了,前排支持啊

WIN7 64位运行出错,选择X86运行正常.
.個朲綉√ 发表于 2011-11-14 12:41

坚决不装WIN7,不知道情况
发表于 2011-11-14 13:26:10 | 显示全部楼层
有点意思谢谢分享。
发表于 2011-11-14 13:27:10 | 显示全部楼层
回复看一下啦
发表于 2011-11-14 13:47:47 | 显示全部楼层
回复 1# seniors
这会看看能不能实现360效果GUI.
发表于 2011-11-14 13:55:04 | 显示全部楼层
回复 1# seniors
没找到这个函数啊?
;_RTEmptyWorkingSet()
给它注释掉了,呵呵!
 楼主| 发表于 2011-11-14 14:19:12 | 显示全部楼层
回复  seniors
没找到这个函数啊?
;_RTEmptyWorkingSet()
给它注释掉了,呵呵!
newuser 发表于 2011-11-14 13:55


压缩包里不是有Thread.au3,
_RTEmptyWorkingSet(),这句是减少内存占用的
发表于 2011-11-14 14:44:08 | 显示全部楼层
看上去不错,支持下哦,谢谢!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-3-28 19:57 , Processed in 0.100749 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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